@view-transition {
  navigation: auto; }
/* ── ページ遷移の方向: 進む=右から左 / 戻る=左から右 ──
   nav-transition.js が遷移方向を <html class="nav-back"> で伝える（無し=進む）。
   root グループ(=ヘッダー/パンくずを除いた本文)を横スライドさせる。 */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 260ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: both; }
/* 進む(forward): 旧は左へ抜け、新は右から入る */
::view-transition-old(root) {
  animation-name: navSlideOutToLeft; }
::view-transition-new(root) {
  animation-name: navSlideInFromRight; }
/* 戻る(back): 旧は右へ抜け、新は左から入る */
html.nav-back::view-transition-old(root) {
  animation-name: navSlideOutToRight; }
html.nav-back::view-transition-new(root) {
  animation-name: navSlideInFromLeft; }
@keyframes navSlideOutToLeft {
  to {
    opacity: 0;
    transform: translateX(-32px); } }
@keyframes navSlideInFromRight {
  from {
    opacity: 0;
    transform: translateX(32px); } }
@keyframes navSlideOutToRight {
  to {
    opacity: 0;
    transform: translateX(32px); } }
@keyframes navSlideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-32px); } }
/* ── ページ遷移アニメ: 共通ヘッダー帯とパンくずは固定し、変わる本文だけ動かす ──
   .app-header / .page-header を独立した view-transition グループに切り出して
   アニメーションを無効化（遷移中そのまま据え置く）。切り出した分だけ root から除かれ、
   残りの本文(タイトル+リスト)だけが上記の root 横スライドで切り替わる。 */
.app-header {
  view-transition-name: vt-app-header; }
.page-header {
  view-transition-name: vt-breadcrumb; }
::view-transition-group(vt-app-header),
::view-transition-group(vt-breadcrumb) {
  animation: none; }
::view-transition-old(vt-app-header),
::view-transition-old(vt-breadcrumb) {
  animation: none;
  opacity: 0; }
::view-transition-new(vt-app-header),
::view-transition-new(vt-breadcrumb) {
  animation: none;
  opacity: 1; }
:root {
  /* ときかた先生ブランドカラー:
     ブランド青#007bc7 / 濃紺#005690 / シアン#00a7e1 / 淡青#DCEFF9 / 黄#ffc107 / 白#FFFFFF / 墨#333333 */
  --primary-color: #007bc7;
  --secondary-blue: #00a7e1;
  --accent-color: #007bc7;
  --button-primary: #007bc7;
  --button-hover: #00619c;
  --bg-color: #FFFFFF;
  --light-bg: #F2F4F7;
  --text-color: #333333;
  --heading-color: #005690;
  --surface-color: #FFFFFF;
  --surface-muted: #f8f9fa;
  --line-color: #cccccc;
  --line-strong: #777777;
  --muted-color: #555555;
  --success-color: #414753;
  --danger-color: #ba1a1a;
  --warning-color: #ba1a1a;
  /* フラットデザイン: ドロップシャドーは廃止（輪郭は border / 背景コントラストで表現） */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --radius-2xs: 4px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-pill: 999px;
  --font-base: "BIZ UDPGothic", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  --content-width: 920px;
  --narrow-width: 760px;
  --chat-width: 860px;
  --transition: 0.18s ease;
  /* ─── chat (gyokan/ai-teacher) 用カラーパレット ─────────
     General版: CTA は青 #007bc7 系・装飾アクセントのみ黄 #ffc107
     役割ベースの中立名（accent=主アクセント / action=CTA / highlight=装飾黄） */
  --ui-accent:          #007bc7;
  --ui-accent-soft:     #DCEFF9;
  --ui-accent-dark:     #00619c;
  --ui-action:          #007bc7;
  --ui-action-soft:     #DCEFF9;
  --ui-action-dark:     #00619c;
  --ui-highlight:       #ffc107;
  --ui-highlight-soft:  #fff6e8;   /* 装飾黄の淡背景（注意/ヘルプ系カード） */
  --ui-highlight-ink:   #7a5500;   /* 黄/白いずれの地でも AA な濃い琥珀テキスト */
  --ui-highlight-ring:  rgba(255, 193, 7, 0.5);  /* 注意喚起フラッシュ用の黄リング（--ui-highlight のα版） */
  /* base = ニュートラルオフホワイト (クール系、node-prod 寄り) */
  --ui-base:            #f8f9fa;
  --ui-surface:       #FFFFFF;
  --ui-surface-muted: #edeeef;
  --ui-divider:       #e7e8e9;
  --ui-ink-primary:   #191c1d;
  --ui-ink-secondary: #414753;
  --ui-ink-tertiary:  #727784;
  --ui-success:       #414753;
  /* positive = 完了/達成の緑。青(=未完/進行中)と対比するため success(グレー)とは別に用意。
     生徒カレンダーの「全部できた」緑 var(--ui-positive) を正とし teacher 系もこれに寄せる。 */
  --ui-positive:      #2E9E5B;
  --ui-positive-dark: #1f7a44;
  --ui-positive-soft: #e4f4ea;
  --ui-danger-soft:   #fff5f5;   /* 危険の淡背景（生徒側 .assist-overdue 由来） */
  --ui-shadow-1:      none;
  --sidebar-width:      240px;
  --nav-active-bg:      var(--ui-accent-soft);
  --nav-active-ink:     var(--primary-color);
  --ui-shadow-2:      none; }
*,
*::before,
*::after {
  box-sizing: border-box; }
html {
  min-height: 100%;
  font-size: 16px;
  background: var(--light-bg); }
body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-base);
  font-weight: 400;
  color: var(--text-color);
  background: var(--light-bg);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; }
body,
button,
input,
textarea,
select {
  letter-spacing: 0; }
button,
input,
textarea,
select {
  font: inherit; }
button {
  cursor: pointer; }
button:disabled {
  cursor: not-allowed; }
a {
  color: var(--primary-color);
  text-decoration: none; }
a:hover {
  color: var(--button-hover); }
img,
svg,
video,
iframe {
  max-width: 100%; }
/* 本文の読み込みアニメ（view-transition 非対応ブラウザ向けフォールバック）。
   方向は navSlideInFromRight/Left を流用（進む=右から / 戻る=左から）。
   横スライドで本文がはみ出す分は overflow-x: clip でクリップ（スクロールバー抑止）。 */
.main-content {
  min-height: calc(100vh - 54px);
  overflow-x: clip;
  animation: navSlideInFromRight 260ms cubic-bezier(0.4, 0, 0.2, 1) both; }
html.nav-back .main-content {
  animation-name: navSlideInFromLeft; }
/* パンくず付きの階層ページ(科目/教材/単元)では、帯ごと動かさず本文だけスライドさせる。
   .page-header は .main-content の子なので、そのまま .main-content をアニメさせると
   パンくずも一緒に動いてしまう。本文(タイトル+リスト)だけにアニメを付け替える。 */
.main-content:has(> .page-container > .page-header) {
  animation: none; }
.main-content:has(> .page-container > .page-header) .page-container > :not(.page-header) {
  animation: navSlideInFromRight 260ms cubic-bezier(0.4, 0, 0.2, 1) both; }
html.nav-back .main-content:has(> .page-container > .page-header) .page-container > :not(.page-header) {
  animation-name: navSlideInFromLeft; }
/* クロスドキュメント view-transition 実行中は VT 側の横スライドに任せ、
   この読み込みアニメは止めて二重がけを防ぐ（vt-active は nav-transition.js が付与） */
html.vt-active .main-content,
html.vt-active .main-content .page-container > :not(.page-header) {
  animation: none !important; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 54px;
  background: var(--primary-color);
  color: #FFFFFF;
  box-shadow: none; }
.header-inner {
  width: min(100%, var(--content-width));
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem; }
.app-title {
  color: #FFFFFF;
  font-weight: 700;
  font-size: 1.18rem;
  line-height: 1.3;
  letter-spacing: 0.03em;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; }
.app-title:hover {
  opacity: 0.85; }
.header-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0; }
.header-logo-image {
  display: block;
  width: auto;
  height: 25px;
  object-fit: contain; }
.header-action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 15px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #FFFFFF;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition); }
.header-action:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: #FFFFFF;
  color: #FFFFFF; }
.header-action:active {
  background: rgba(255, 255, 255, 0.24); }
.header-action:focus-visible {
  outline: 2px solid #FFFFFF;
  outline-offset: 2px; }
.page-container {
  width: min(100%, var(--narrow-width));
  margin: 0 auto;
  padding: 36px 24px 64px; }
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px; }
.page-title {
  margin: 0 0 28px;
  color: var(--heading-color);
  font-size: 2rem;
  line-height: 1.3;
  font-weight: 800; }
.compact-title {
  margin: 0;
  font-size: 1.55rem; }
.breadcrumb-title {
  min-width: 0;
  color: var(--muted-color);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.6;
  overflow-wrap: anywhere; }
.breadcrumb-link {
  color: var(--primary-color);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none; }
.breadcrumb-link:hover {
  text-decoration: underline; }
.back-btn,
.chat-exp-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  color: var(--primary-color);
  background: var(--surface-color);
  box-shadow: var(--shadow-sm);
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition); }
.back-btn:hover,
.chat-exp-back-btn:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md); }
.grid-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 16px; }
.card-list {
  display: grid;
  gap: 12px; }
.grade-section {
  margin-top: 28px; }
.grade-section:first-child {
  margin-top: 0; }
.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--heading-color);
  font-size: 1.08rem;
  font-weight: 800; }
.section-label::before {
  content: "";
  width: 6px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--accent-color); }
.grid-card,
.list-card {
  position: relative;
  display: flex;
  min-height: 92px;
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  background: var(--surface-color);
  color: var(--text-color);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition); }
.grid-card {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  padding: 20px; }
.list-card {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px; }
.grid-card:hover,
.list-card:hover {
  color: var(--text-color);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md); }
.grid-card-title,
.material-card-title {
  display: block;
  color: var(--heading-color);
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere; }
.grid-card-meta,
.list-card-subtitle {
  display: block;
  color: var(--muted-color);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.5; }
.list-card-text {
  min-width: 0;
  display: block; }
.material-card-main {
  display: grid;
  gap: 4px; }
.list-card-arrow {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ui-highlight);
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: 1.3rem;
  font-weight: 800; }
.material-leaf-card .list-card-arrow {
  color: var(--ui-highlight);
  background: transparent; }
.empty-message {
  margin: 0;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted-color);
  background: var(--surface-color);
  text-align: center;
  font-weight: 700; }
.loading-block {
  display: grid;
  gap: 16px; }
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #DCEFF9; }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: skeletonSlide 1.2s infinite; }
@keyframes skeletonSlide {
  100% {
    transform: translateX(100%); } }
.skeleton-title {
  width: 220px;
  height: 28px; }
.skeleton-card {
  height: 96px; }
.skeleton-list-card {
  height: 92px; }
.skeleton-stage {
  height: 74px; }
/* --- 講師ページ・管理画面向けの汎用スケルトン（生徒ページの .skeleton 系と同じ shimmer を共有） --- */
.skeleton-line {
  height: 14px;
  border-radius: var(--radius-xs); }
.skeleton-line.sk-sm { width: 40%; }
.skeleton-line.sk-md { width: 60%; }
.skeleton-line.sk-lg { width: 80%; }
.skeleton-kpi-value {
  height: 28px;
  width: 72px;
  margin-top: 6px; }
.skeleton-alert-row {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-sm); }
.skeleton-cell {
  height: 16px;
  border-radius: var(--radius-xs); }
.skeleton-mon-card {
  min-height: 168px;
  border-radius: var(--radius-md); }
.skeleton-attendance-card {
  height: 104px;
  border-radius: var(--radius-md); }
.skeleton-tree-row {
  height: 18px;
  margin-bottom: 10px;
  border-radius: var(--radius-xs); }
/* .explanation-container / .explanation-header はいずれも ai-teacher 専用。
   定義は後半ブロック（ai-teacher 再実装）へ統合済み。旧 chat-exp 系も削除済み。 */
.chat-exp-subtitle {
  margin-top: 3px;
  color: var(--muted-color);
  font-size: 0.86rem;
  font-weight: 700; }
.problem-summary-panel,
.stage-start-card,
.pre-chat-support-panel {
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  background: var(--surface-color);
  box-shadow: var(--shadow-sm); }
.problem-summary-panel {
  padding: 22px;
  margin-bottom: 18px; }
.problem-summary-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px; }
.info-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  color: #FFFFFF;
  background: var(--primary-color);
  font-size: 0.82rem;
  font-weight: 800; }
.problem-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; }
.problem-detail-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  background: var(--surface-muted); }
.detail-label {
  display: block;
  color: var(--muted-color);
  font-size: 0.78rem;
  font-weight: 800; }
.detail-value {
  display: block;
  margin-top: 4px;
  color: var(--text-color);
  font-size: 0.98rem;
  font-weight: 800;
  overflow-wrap: anywhere; }
.stage-start-panel {
  margin: 18px 0; }
.stage-start-card {
  padding: 22px; }
.stage-start-header {
  display: grid;
  gap: 4px;
  margin-bottom: 10px; }
.stage-start-kicker {
  color: var(--accent-color);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase; }
.stage-start-title {
  margin: 0;
  color: var(--heading-color);
  font-size: 1.28rem;
  line-height: 1.4; }
.stage-start-text,
.stage-start-note {
  margin: 0;
  color: var(--muted-color);
  font-size: 0.95rem; }
.stage-option-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 18px 0; }
.stage-option-btn {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 13px 14px;
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  background: var(--surface-color);
  color: var(--text-color);
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition); }
.stage-option-btn:hover,
.stage-option-btn.active {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 129, 204, 0.14); }
.stage-option-btn.active {
  background: #DCEFF9; }
.stage-option-label {
  color: var(--heading-color);
  font-weight: 900; }
.stage-option-meta {
  color: var(--muted-color);
  font-size: 0.8rem;
  font-weight: 700; }
.stage-start-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px; }
/* .complete-btn / .send-btn / .primary-btn / .secondary-btn はいずれも ai-teacher 専用。
   後半ブロック（ai-teacher 再実装）へ統合済み。 */
.pre-chat-support-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  overflow: hidden; }
.support-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 16px;
  color: var(--muted-color);
  font-size: 0.88rem;
  font-weight: 800;
  border-right: 1px solid var(--line-color); }
.support-item:last-child {
  border-right: 0; }
.support-number {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  color: #FFFFFF;
  background: var(--primary-color);
  font-size: 0.8rem;
  font-weight: 900; }
/* ─── chat-exp (gyokan.html / ai-teacher.html) 共通: node-prod 版踏襲 + --ui-* トークン ─── */
.chat-exp-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 54px);
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 0;
  background: var(--ui-base); }
.chat-exp-header {
  background: var(--ui-surface);
  color: var(--ui-ink-primary);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid var(--ui-divider);
  flex-shrink: 0;
  margin-bottom: 0; }
/* chat-exp-back-btn を chat 内で軽量ボタンに override（上の back-btn 共通定義を打ち消し） */
.chat-exp-container .chat-exp-back-btn {
  background: none;
  border: none;
  color: var(--ui-ink-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.15rem;
  line-height: 1;
  text-decoration: none;
  display: flex;
  align-items: center;
  min-height: auto;
  box-shadow: none;
  transition: color var(--transition); }
.chat-exp-container .chat-exp-back-btn:hover {
  color: var(--ui-accent);
  text-decoration: none;
  background: none;
  border-color: transparent;
  transform: none;
  box-shadow: none; }
.chat-exp-title {
  flex: 1;
  min-width: 0; }
.chat-exp-title h3 {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  word-break: normal;
  color: var(--ui-ink-primary); }
.chat-exp-title span {
  font-size: 0.78rem;
  color: var(--ui-ink-secondary); }
.chat-exp-level-bar {
  background: var(--ui-surface);
  border: none;
  border-bottom: 1px solid var(--ui-divider);
  border-radius: 0;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin-bottom: 0;
  box-shadow: none;
  justify-content: flex-start; }
.level-bar-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ui-ink-secondary);
  white-space: nowrap; }
.level-bar-buttons {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-start; }
.level-bar-btn {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ui-divider);
  background: var(--ui-surface-muted);
  color: var(--ui-ink-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  font-family: var(--font-base);
  min-height: auto; }
.level-bar-btn:hover {
  border-color: var(--ui-action);
  color: var(--ui-action);
  background: var(--ui-surface-muted); }
.level-bar-btn.active,
.level-bar-btn.active[data-level="-1"],
.level-bar-btn.active[data-level="-2"],
.level-bar-btn.active[data-level="-3"] {
  background: var(--ui-action);
  color: #FFFFFF;
  border-color: var(--ui-action);
  box-shadow: none; }
/* level-bar とチャット画面の間に置く細いプログレスバー（主張は控えめ） */
.chat-progress-line {
  height: 2px;
  background: var(--ui-divider);
  flex-shrink: 0;
  overflow: hidden; }
.chat-progress-line-fill {
  height: 100%;
  width: 0%;
  background: var(--ui-action);
  transition: width 200ms cubic-bezier(0.4, 0, 0.2, 1); }
.chat-exp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--ui-base);
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
  scroll-behavior: smooth; }
.chat-exp-messages::-webkit-scrollbar { width: 5px; }
.chat-exp-messages::-webkit-scrollbar-track { background: transparent; }
.chat-exp-messages::-webkit-scrollbar-thumb { background: var(--ui-divider); border-radius: var(--radius-2xs); }
.chat-exp-messages.typewriting-active {
  cursor: progress;
  pointer-events: none;
  user-select: none; }
.chat-msg-row {
  display: flex;
  width: 100%;
  margin-bottom: 10px;
  animation: bubbleFadeIn 220ms ease both; }
@keyframes bubbleFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px); }
  to {
    opacity: 1;
    transform: translateY(0); } }
.ai-row {
  justify-content: flex-start; }
.user-row {
  justify-content: flex-end; }
/* バブル共通 (node-prod 版踏襲: bottom-left しっぽ + animation bubbleIn) */
.exp-bubble {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md);
  position: relative;
  animation: bubbleIn 0.26s ease-out;
  line-height: 1.55;
  font-size: 0.94rem;
  cursor: pointer;
  word-break: normal;
  overflow-wrap: anywhere;
  box-shadow: none;
  border: 1px solid transparent; }
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(14px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); } }
/* 通常バブル（白面 + 軽い影 + bottom-left しっぽ） */
.exp-bubble.received {
  background: var(--ui-surface);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
  border-top-left-radius: 12px;
  box-shadow: var(--ui-shadow-1);
  border: 1px solid var(--ui-divider);
  color: var(--ui-ink-primary); }
.exp-bubble.received::before {
  content: '';
  position: absolute;
  left: -7px;
  bottom: 0;
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-right-color: var(--ui-surface);
  border-bottom-color: var(--ui-surface); }
/* 送信バブル（ai-teacher 用、--ui-* トークン色） */
.exp-bubble.sent {
  color: #FFFFFF;
  background: var(--primary-color);
  border-color: var(--primary-color);
  border-top-right-radius: 4px;
  align-self: flex-end; }
/* typewriter カーソル (--ui-action) */
.exp-bubble.typewriting::after {
  content: "|";
  display: inline-block;
  margin-left: 2px;
  color: var(--ui-action);
  animation: cursorBlink 0.7s step-end infinite; }
@keyframes cursorBlink {
  50% {
    opacity: 0; } }
/* bubble-content 装飾（node-prod 版踏襲 + --ui-* トークン） */
.bubble-content { color: var(--ui-ink-primary); }
.bubble-content > :first-child { margin-top: 0; }
.bubble-content > :last-child { margin-bottom: 0; }
.bubble-content p { margin: 0.3rem 0; }
.bubble-content p:first-child { margin-top: 0; }
.bubble-content p:last-child { margin-bottom: 0; }
.bubble-content h2,
.bubble-content h3 {
  margin: 0.6rem 0 0.3rem;
  color: var(--ui-ink-primary);
  font-size: 0.95rem; }
.bubble-content strong { font-weight: 700; color: var(--ui-ink-primary); }
.bubble-content em { font-style: italic; color: var(--ui-ink-secondary); }
.bubble-content code {
  background: var(--ui-surface-muted);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-2xs);
  font-size: 0.88em;
  border: 1px solid var(--ui-divider); }
.bubble-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 0.5rem 0;
  box-shadow: var(--ui-shadow-1); }
.bubble-content ul,
.bubble-content ol { margin: 0.3rem 0 0.3rem 1.25rem; }
.bubble-content li { margin-bottom: 0.15rem; }
.bubble-content pre {
  padding: 12px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: #2e3132;
  color: #FFFFFF; }
.bubble-content blockquote {
  margin: 0.3rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--ui-divider);
  color: var(--ui-ink-secondary); }
.bubble-time {
  font-size: 0.7rem;
  color: var(--ui-ink-tertiary);
  text-align: right;
  margin-top: 0.4rem; }
.bubble-level-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 0.4rem;
  background: var(--ui-success);
  white-space: nowrap; }
.bubble-level-badge[data-level="-1"] { background: var(--ui-highlight); }
.bubble-level-badge[data-level="-2"] { background: var(--ui-action); }
.bubble-level-badge[data-level="-3"] { background: var(--ui-action-dark); }
.math-block {
  overflow-x: auto; }
.bubble-content mjx-container {
  overflow: visible;
  max-width: 100%;
  padding: 0.08em 0; }
.bubble-content .math-block {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch; }
/* 省略バブル（dashed border + bottom-left しっぽ + ホバー濃化） */
.skipped-row {
  justify-content: flex-start;
  margin: 0; }
.exp-bubble.skipped {
  width: fit-content;
  max-width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1.5px dashed var(--ui-divider);
  border-bottom-left-radius: 3px;
  border-top-left-radius: 12px;
  color: var(--ui-ink-secondary);
  background: var(--ui-surface-muted);
  align-self: flex-start;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition); }
.exp-bubble.skipped:hover {
  background: var(--ui-divider);
  border-color: var(--ui-ink-tertiary); }
.exp-bubble.skipped::before {
  content: '';
  position: absolute;
  left: -7px;
  bottom: 0;
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-right-color: var(--ui-surface-muted);
  border-bottom-color: var(--ui-surface-muted); }
.skipped-indicator {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--ui-ink-secondary);
  font-size: 0.82rem;
  line-height: 1.25;
  white-space: nowrap; }
.skipped-dots {
  font-size: 1rem;
  letter-spacing: 2px;
  color: var(--ui-ink-tertiary);
  font-weight: 700; }
.skipped-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0; }
.skipped-info {
  font-size: 0.75rem;
  color: var(--ui-ink-tertiary);
  font-weight: 600; }
.skipped-tag {
  display: inline-block;
  background: var(--ui-surface);
  color: var(--ui-ink-primary);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--ui-divider); }
.tap-hint-text {
  font-size: 0.68rem;
  color: var(--ui-action);
  margin-left: auto;
  font-weight: 700; }
/* 展開済みバブル（オレンジ soft 背景 + オレンジしっぽ） */
.exp-bubble.expanded {
  background: var(--ui-action-soft);
  box-shadow: var(--ui-shadow-1);
  border: 1px solid rgba(0, 129, 204, 0.25);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
  border-top-left-radius: 12px; }
.exp-bubble.expanded::before {
  content: '';
  position: absolute;
  left: -7px;
  bottom: 0;
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-right-color: var(--ui-action-soft);
  border-bottom-color: var(--ui-action-soft); }
.expanded-header {
  font-size: 0.75rem;
  color: var(--ui-action);
  margin-bottom: 0.35rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed rgba(0, 129, 204, 0.35);
  font-weight: 700; }
.video-bubble {
  width: 100%; }
.video-caption {
  margin: 0 0 10px;
  color: var(--muted-color);
  font-weight: 800; }
.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000000; }
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0; }
.skeleton-chat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px; }
.skeleton-chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill); }
.skeleton-chat-bubble {
  width: min(78%, 520px);
  height: 48px;
  border-radius: var(--radius-md); }
.skeleton-chat-bubble.short {
  width: min(54%, 360px); }
.chat-exp-footer {
  background: var(--ui-surface);
  padding: 0.5rem 1rem;
  flex-shrink: 0;
  border-top: 1px solid var(--ui-divider);
  display: flex;
  flex-direction: column;
  gap: 0.5rem; }
.chat-footer-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 0; }
.chat-tap-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--ui-ink-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap; }
.tap-icon-anim {
  display: inline-block;
  font-size: 1.05rem;
  color: var(--ui-action);
  animation: tapPulse 1.5s ease-in-out infinite; }
@keyframes tapPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; } }
.chat-complete-row {
  display: flex;
  justify-content: center;
  padding: 0.75rem 1rem 1.25rem; }
.chat-complete-msg {
  background: rgba(65, 71, 83, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-lg);
  color: var(--ui-success);
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-block;
  border: 1px solid rgba(65, 71, 83, 0.2); }
.chat-complete-card {
  margin: 0 auto 1.5rem;
  max-width: 360px;
  width: calc(100% - 2rem);
  background: #FFFFFF;
  border: 1px solid rgba(65, 71, 83, 0.18);
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: 1.25rem 1.25rem 1.5rem;
  text-align: center;
  animation: bubbleFadeIn 0.3s ease-out; }
.chat-complete-card-title {
  margin: 0 0 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: #414753; }
.chat-complete-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem; }
.chat-complete-btn {
  appearance: none;
  border: 1px solid rgba(0, 129, 204, 0.4);
  background: #FFFFFF;
  color: #007bc7;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease; }
.chat-complete-btn:hover {
  background: rgba(0, 129, 204, 0.06); }
.chat-complete-btn:active {
  transform: scale(0.98); }
.chat-complete-btn.primary {
  background: #007bc7;
  border-color: #007bc7;
  color: #FFFFFF; }
.chat-complete-btn.primary:hover {
  background: #003d7d; }
/* Gyokan 起動時のチュートリアル透かし: 画面全体をタップ誘導 */
.tap-tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 22, 28, 0.32);
  -webkit-backdrop-filter: blur(1px);
  backdrop-filter: blur(1px);
  cursor: pointer;
  animation: tapTutorialIn 240ms ease-out; }
.tap-tutorial-overlay[hidden] {
  display: none; }
.tap-tutorial-overlay.dismissed {
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease; }
.tap-tutorial-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: #FFFFFF;
  text-align: center;
  padding: 1.5rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  animation: tapPulse 1.6s ease-in-out infinite; }
.tap-tutorial-icon {
  font-size: 3.4rem;
  line-height: 1; }
.tap-tutorial-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em; }
@keyframes tapTutorialIn {
  from { opacity: 0; }
  to   { opacity: 1; } }
/* chat-exp-progress: gyokan.html ではプレーンテキスト「6/27」用、
   ai-teacher.html で progress bar として使う場合は .chat-progress-fill / .chat-progress-text 子要素経由で */
.chat-exp-progress {
  font-size: 0.78rem;
  color: var(--ui-ink-secondary);
  white-space: nowrap;
  font-weight: 600; }
.chat-exp-progress:has(.chat-progress-fill) {
  position: relative;
  width: 180px;
  height: 28px;
  overflow: hidden;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-pill);
  background: #FFFFFF; }
.chat-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--ui-accent), var(--ui-highlight));
  transition: width 180ms ease; }
.chat-progress-text {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: var(--ui-ink-primary);
  font-size: 0.78rem;
  font-weight: 700; }
.choice-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px; }
/* .choice-btn は ai-teacher 専用（app.js 生成）。後半ブロックへ統合済み。 */
.chat-input-area {
  display: grid;
  gap: 10px; }
.chat-input-area[hidden],
.session-complete[hidden] {
  display: none; }
/* .free-input(-area) / .typing-indicator / .typing-dot / .error-card はいずれも
   ai-teacher 専用。後半ブロックへ統合済み（typing は typingBounce を使用）。 */
.session-complete {
  padding: 12px;
  border: 1px solid rgba(65, 71, 83, 0.25);
  border-radius: var(--radius-sm);
  background: #edeeef; }
.session-complete-title {
  margin: 0 0 4px;
  color: var(--success-color);
  font-weight: 900; }
.session-complete-text {
  margin: 0 0 10px;
  color: var(--muted-color);
  font-size: 0.9rem; }
/* .complete-buttons は ai-teacher 専用。後半ブロックへ統合済み。 */
@media (max-width: 900px) {
  :root {
    --chat-width: 100%; } }
@media (max-width: 720px) {
  .header-inner {
    padding: 0 16px; }
  .page-container,
  .explanation-container {
    padding-inline: 16px;
    padding-top: 20px; }
  .page-title {
    font-size: 1.64rem; }
  .page-header,
  .explanation-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px; }
  .problem-detail-grid,
  .pre-chat-support-panel,
  .choice-buttons,
  .free-input-area {
    grid-template-columns: 1fr; }
  .support-item {
    border-right: 0;
    border-bottom: 1px solid var(--line-color); }
  .support-item:last-child {
    border-bottom: 0; } }
@media (max-width: 480px) {
  html {
    font-size: 15px; }
  .app-header {
    height: 58px; }
  .main-content {
    min-height: calc(100vh - 58px); }
  .grid-list {
    grid-template-columns: 1fr; }
  .list-card {
    padding: 15px 16px; } }
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important; }

  /* Keep the "answer generating" indicator alive as a functional loading
     status, but as a gentle opacity pulse (no motion) to respect the setting. */
  .typing-dot {
    animation-name: typingFade !important;
    animation-duration: 1.3s !important;
    animation-iteration-count: infinite !important;
  } }

/* mode buttons (ときかた先生解説 / AIティーチャー) */
.material-leaf-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: 1rem;
}
.material-leaf-card .list-card-text {
  flex-shrink: 0;
}
.mode-btn {
  display: inline-block;
  flex: 1;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  text-align: center;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}
.mode-btn--gyokan {
  background: #3780b9;
  color: #fff142;
}
.mode-btn--ai-teacher {
  background: #ffeb40;
  color: #3780b9;
}
.mode-btn--gyokan:hover { background: #2f73a7; color: #fff36b; }
.mode-btn--ai-teacher:hover { background: #f4df39; color: #2f73a7; }
.mode-btn--unavailable {
  background: #d9dadb;
  color: #414753;
  cursor: not-allowed;
  pointer-events: none;
}
.material-leaf-card--unavailable {
  opacity: 0.7;
}
.material-leaf-card--unavailable .material-card-title {
  color: #414753;
}

/* Gyokan viewer */
.gyokan-card {
  background: var(--bg-color, #fff);
  border: 1px solid #c1c6d5;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}
.gyokan-card-header {
  font-weight: bold;
  color: var(--heading-color, #007bc7);
  margin-bottom: 8px;
}
.gyokan-video-card {
  background: var(--light-bg, #f3f4f5);
  border-left: 4px solid var(--accent-color, #007bc7);
  padding: 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-2xs);
}

/* 狭い画面では番号の上・ボタン下の縦積みに切り替え（ボタン2つの通常カードのみ）。
   準備中カードはラベルが短いので横並びのまま維持する */
@media (max-width: 600px) {
  .material-leaf-card:not(.material-leaf-card--unavailable) {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .material-leaf-card:not(.material-leaf-card--unavailable) .material-leaf-actions {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
  .mode-btn { flex: 0 1 auto; }
}

/* ─── ai-teacher.html: node-prod AI 対話 UI + --ui-* トークン ─────────── */
:root {
  --ui-danger: #ba1a1a;
}

.empty-message {
  color: var(--ui-ink-secondary);
  text-align: center;
  padding: 2.5rem;
  font-size: 0.95rem;
  background: var(--ui-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--ui-divider);
}

.explanation-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: calc(100vh - 54px);
  width: 100%;
  padding: 0;
  gap: 0;
  margin-bottom: 0;
  background: var(--ui-base);
}

.explanation-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  padding-inline: max(1.25rem, calc((100% - 800px) / 2));
  margin-bottom: 0;
  background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-divider);
  flex-shrink: 0;
}

.chat-history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-block: 1rem;
  padding-inline: max(1.25rem, calc((100% - 800px) / 2));
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--ui-base);
}

.chat-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  max-width: 85%;
}

.chat-row.ai-row {
  align-self: flex-start;
  max-width: 94%;
}

.chat-row.user-row {
  align-self: flex-end;
  flex-direction: row-reverse;
  align-items: flex-end;
}

.chat-avatar {
  flex: 0 0 auto;
  font-size: 1.1rem;
  line-height: 1.6;
}

.chat-card {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-lg);
  line-height: 1.75;
  font-size: 0.975rem;
  animation: fadeInUp 0.24s ease;
  overflow-wrap: anywhere;
}

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

.ai-card {
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-2);
  border: 1px solid var(--ui-divider);
  border-left: 3px solid var(--ui-action);
  border-bottom-left-radius: var(--radius-sm);
  color: var(--ui-ink-primary);
}

/* AI 解説のタイプライター表示（gyokan 踏襲）。cursorBlink キーフレームは共通。 */
.chat-card.typewriting::after {
  content: "|";
  display: inline-block;
  margin-left: 2px;
  color: var(--ui-action);
  animation: cursorBlink 0.7s step-end infinite;
}

.chat-card .tw-math {
  display: inline;
}

.chat-card .tw-math.tw-math-block {
  display: block;
  margin: 0.5rem 0;
}

.user-card {
  background: var(--ui-action);
  color: #FFFFFF;
  box-shadow: var(--ui-shadow-2);
  border: none;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-card > :first-child {
  margin-top: 0;
}

.chat-card p {
  margin-bottom: 0.75rem;
}

.chat-card p:last-child {
  margin-bottom: 0;
}

.chat-card h1,
.chat-card h2,
.chat-card h3 {
  margin: 0.75rem 0 0.5rem;
  font-size: 1rem;
  color: var(--ui-ink-primary);
}

.chat-card ul,
.chat-card ol {
  margin: 0.5rem 0 0.5rem 1.5rem;
}

.chat-card li {
  margin-bottom: 0.25rem;
}

.chat-card table {
  border-collapse: separate;
  border-spacing: 0;
  margin: 0.75rem 0;
  font-size: 0.9rem;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--ui-shadow-1);
  border: 1px solid var(--ui-divider);
}

.chat-card th {
  background: var(--ui-surface-muted);
  color: var(--ui-ink-primary);
  padding: 0.45rem 0.75rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--ui-divider);
}

.chat-card td {
  border-bottom: 1px solid var(--ui-divider);
  padding: 0.4rem 0.75rem;
  text-align: left;
}

.chat-card tr:nth-child(even) td {
  background: var(--ui-base);
}

.chat-card tr:last-child td {
  border-bottom: none;
}

.chat-card code {
  background: var(--ui-surface-muted);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-2xs);
  font-size: 0.88em;
  font-family: "SF Mono", "Menlo", "Noto Sans Mono CJK JP", monospace;
  color: var(--ui-ink-primary);
  border: 1px solid var(--ui-divider);
}

.chat-card pre {
  background: var(--ui-surface-muted);
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0.5rem 0;
  border: 1px solid var(--ui-divider);
}

.chat-card pre code {
  background: none;
  padding: 0;
  border: none;
}

.chat-card strong {
  font-weight: 700;
  color: var(--ui-ink-primary);
}

.chat-card em {
  font-style: italic;
  color: var(--ui-ink-secondary);
}

.chat-card blockquote {
  border-left: 3px solid var(--ui-action);
  padding: 0.5rem 0.75rem 0.5rem 0.875rem;
  color: var(--ui-ink-secondary);
  margin: 0.5rem 0;
  font-style: italic;
  background: var(--ui-action-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.user-card strong,
.user-card em,
.user-card code {
  color: #FFFFFF;
}

.user-card code {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.user-card h1,
.user-card h2,
.user-card h3 {
  color: rgba(255, 255, 255, 0.95);
}

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--ui-ink-secondary);
  font-size: 0.9rem;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  position: relative;
  animation: spin 0.9s linear infinite;
}

.loading-spinner::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--ui-divider);
  border-top-color: var(--ui-action);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  background: var(--ui-surface);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-sm);
  align-self: flex-start;
  max-width: 180px;
  box-shadow: var(--ui-shadow-1);
  border: 1px solid var(--ui-divider);
}

.typing-label {
  color: var(--ui-ink-secondary);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--ui-action);
  border-radius: 50%;
  animation: typingBounce 1.3s infinite;
  opacity: 0.6;
}

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

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

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-7px);
    opacity: 1;
  }
}

/* Gentle opacity-only pulse used when the user prefers reduced motion */
@keyframes typingFade {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

.input-area {
  flex-shrink: 0;
  background: var(--ui-surface);
  border-top: 1px solid var(--ui-divider);
  padding: 0.6rem 0;
  padding-inline: max(1.25rem, calc((100% - 800px) / 2));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.button-area {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.choice-btn {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0.45rem 1rem;
  background: var(--ui-surface-muted);
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-pill);
  color: var(--ui-ink-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  font-family: var(--font-base);
}

@media (hover: hover) {
  .choice-btn:hover:not(:disabled) {
    background: var(--ui-action-soft);
    border-color: var(--ui-action);
    color: var(--ui-action);
  }
}

.choice-btn:active:not(:disabled) {
  background: var(--ui-action-soft);
}

.choice-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hint-btn {
  color: var(--ui-highlight);
  border-color: rgba(114, 119, 132, 0.35);
}

@media (hover: hover) {
  .hint-btn:hover:not(:disabled) {
    background: rgba(114, 119, 132, 0.1);
    border-color: var(--ui-highlight);
    color: var(--ui-highlight);
  }
}

.free-input-area {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.free-input {
  flex: 1;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--ui-divider);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: var(--font-base);
  line-height: 1.5;
  resize: none;
  outline: none;
  background: var(--ui-surface);
  color: var(--ui-ink-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 40px;
  max-height: 120px;
}

.free-input:focus {
  border-color: var(--ui-action);
  box-shadow: 0 0 0 3px rgba(0, 129, 204, 0.12);
}

.free-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--ui-surface-muted);
}

.free-input::placeholder {
  color: var(--ui-ink-tertiary);
}

.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.35rem;
  background: var(--ui-action);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
  font-family: var(--font-base);
  height: 44px;
}

.send-btn:hover:not(:disabled) {
  background: var(--ui-action-dark);
  box-shadow: none;
}

.send-btn:active:not(:disabled) {
  box-shadow: none;
  transform: translateY(0);
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.complete-area {
  flex-shrink: 0;
  background: var(--ui-surface);
  border-top: 1px solid var(--ui-divider);
  padding: 1rem 0;
  padding-inline: max(1.25rem, calc((100% - 800px) / 2));
}

.complete-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.complete-btn {
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  font-family: var(--font-base);
  border: none;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.primary-btn {
  background: var(--ui-action);
  color: #FFFFFF;
  box-shadow: none;
}

.primary-btn:hover {
  background: var(--ui-action-dark);
  box-shadow: none;
  color: #FFFFFF;
  text-decoration: none;
}

.primary-btn:active {
  box-shadow: none;
  transform: translateY(0);
}

.secondary-btn {
  background: var(--ui-surface-muted);
  color: var(--ui-ink-primary);
  border: 1px solid var(--ui-divider);
}

.secondary-btn:hover {
  background: var(--ui-divider);
  color: var(--ui-ink-primary);
  text-decoration: none;
}

.secondary-btn:active {
  transform: translateY(0);
}

.error-card {
  background: rgba(186, 26, 26, 0.06);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  color: var(--ui-danger);
  font-size: 0.9rem;
  font-weight: 800;
  align-self: flex-start;
  max-width: 85%;
  border: 1px solid rgba(186, 26, 26, 0.2);
  border-left: 3px solid var(--ui-danger);
}

.chat-history::-webkit-scrollbar {
  width: 5px;
}

.chat-history::-webkit-scrollbar-track {
  background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
  background: var(--ui-divider);
  border-radius: var(--radius-2xs);
}

.chat-history::-webkit-scrollbar-thumb:hover {
  background: var(--ui-ink-tertiary);
}

/* ─── ai-teacher-stage.html: 学習段階選択ページ ─────────── */
.stage-select-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  width: 100%;
}

.stage-select-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stage-select-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--ui-shadow-1);
}

.stage-select-title {
  margin: 0 0 0.75rem;
  color: var(--heading-color);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.5;
}

.stage-select-lead {
  margin: 0 0 1.25rem;
  color: var(--ui-ink-primary);
  font-size: 0.95rem;
  line-height: 1.7;
}

.stage-select-label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--heading-color);
  font-size: 0.9rem;
  font-weight: 700;
}

.stage-select-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.stage-select {
  width: 100%;
  padding: 0.65rem 2.25rem 0.65rem 0.9rem;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-sm);
  background-color: var(--ui-surface);
  color: var(--ui-ink-primary);
  font-size: 0.95rem;
  font-family: var(--font-base);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235B616B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
}

.stage-select:focus {
  outline: none;
  border-color: var(--ui-action);
  box-shadow: 0 0 0 3px rgba(0, 129, 204, 0.12);
}

.stage-start-btn {
  display: block;
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--ui-action);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 1rem;
  box-shadow: none;
  transition: background var(--transition);
  font-family: var(--font-base);
}

.stage-start-btn:hover:not(:disabled) {
  background: var(--ui-action-dark);
}

.stage-start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.stage-select-note {
  margin: 0;
  color: var(--ui-ink-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ─── ページローディングオーバーレイ（ブランドロゴ・最低表示時間つき） ── */
.page-loading-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(229, 229, 229, 0.96);
  z-index: 250;
  transition: opacity 0.26s ease, visibility 0.26s ease;
}

.page-loading-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-indicator--logo {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.loading-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.loading-logo {
  display: block;
  width: min(230px, 72vw);
  height: auto;
  object-fit: contain;
}

/* 進捗不確定のインジケータバー（縞が左右に流れ続ける） */
.loading-progress {
  position: relative;
  width: min(230px, 72vw);
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(0, 129, 204, 0.16);
  overflow: hidden;
}

.loading-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: var(--primary-color);
  animation: loadingBarSlide 1.4s ease-in-out infinite;
}

@keyframes loadingBarSlide {
  0% {
    left: -40%;
    width: 40%;
  }
  50% {
    width: 55%;
  }
  100% {
    left: 100%;
    width: 40%;
  }
}

.loading-caption {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--heading-color);
  letter-spacing: 0.02em;
}

/* ─── 生徒・講師ログイン ───────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #edf3fa 100%);
}

.login-container {
  width: min(100%, 420px);
  padding: 30px 24px 28px;
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  background: var(--surface-color);
  box-shadow: var(--shadow-md);
}

.login-logo {
  display: block;
  height: 34px;
  width: auto;
  margin: 0 auto 14px;
}

.login-title {
  margin: 0 0 24px;
  color: var(--heading-color);
  font-size: 1.45rem;
  line-height: 1.35;
  text-align: center;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-field {
  display: grid;
  gap: 6px;
  color: var(--ui-ink-secondary);
  font-size: 0.92rem;
  font-weight: 800;
}

.login-field input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  color: var(--text-color);
  background: #fff;
  font-size: 1rem;
}

.login-field input:focus {
  outline: 3px solid rgba(0, 129, 204, 0.18);
  border-color: var(--primary-color);
}

.login-submit {
  min-height: 46px;
  border: 0;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--button-primary);
  font-weight: 800;
  transition: background var(--transition), transform var(--transition);
}

.login-submit:hover {
  background: var(--button-hover);
}

.login-submit:active {
  transform: translateY(1px);
}

.login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-submit:disabled {
  opacity: 0.85;
  cursor: progress;
}

.login-submit-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.login-submit.is-loading .login-submit-spinner {
  display: inline-block;
}

.login-error {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(186, 26, 26, 0.35);
  border-radius: var(--radius-sm);
  color: var(--danger-color);
  background: rgba(186, 26, 26, 0.08);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.6;
}

@media (max-width: 480px) {
  .loading-logo,
  .loading-progress {
    width: min(210px, 78vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-progress-bar {
    animation: none;
    left: 0;
    width: 100%;
    opacity: 0.6;
  }
}

/* ─── アシストモード (student/assist.html) ───────────────── */
.assist-main { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.assist-loading { text-align: center; color: var(--muted-color); }
.assist-card {
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px; }
.assist-card-title { margin: 0 0 4px; font-size: 1.1rem; color: var(--heading-color); }
.assist-card-sub { margin: 0 0 12px; color: var(--muted-color); font-size: 0.9rem; }
.assist-overdue { border-color: var(--danger-color); background: #fff5f5; }

.assist-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.assist-list-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-muted); border-radius: var(--radius-sm); }
.assist-list-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assist-chip { flex-shrink: 0; min-width: 1.6em; text-align: center; font-weight: 700; border-radius: var(--radius-pill); padding: 1px 8px; font-size: 0.85rem; }
.assist-chip.todo { background: var(--line-color); color: var(--text-color); }
.assist-chip.done { background: var(--primary-color); color: #fff; }
.assist-chip.grade-maru { background: #1A6BBF; color: #fff; }
.assist-chip.grade-sankaku { background: var(--ui-highlight); color: #000; }
.assist-chip.grade-batsu { background: var(--danger-color); color: #fff; }
/* カード右側の教科チップ＋ページ（#90） */
.assist-list-meta { flex: none; display: flex; align-items: center; gap: 6px; }
.assist-list-subject {
  background: var(--ui-accent-soft); color: var(--ui-accent-dark);
  border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 700; padding: 2px 9px;
}
.assist-list-page { font-size: 0.72rem; color: var(--muted-color); white-space: nowrap; }
/* 教科ごとの折りたたみグループ（2教科以上のとき・#90） */
.assist-group { display: block; }
.assist-group-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; background: var(--surface-muted); border: none;
  border-radius: var(--radius-sm); cursor: pointer; font: inherit; text-align: left; color: inherit;
}
.assist-group-name { flex: 1; min-width: 0; font-weight: 700; }
.assist-group-count { flex: none; font-size: 0.78rem; color: var(--muted-color); }
.assist-group-body { list-style: none; margin: 6px 0 0; padding: 0 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.assist-group-body[hidden] { display: none; }

.assist-btn { width: 100%; padding: 12px; border: none; border-radius: var(--radius-pill); font-weight: 700; }
.assist-btn:disabled { opacity: 0.5; }
.assist-btn-primary { background: var(--button-primary); color: #fff; }
.assist-btn-primary:hover:not(:disabled) { background: var(--button-hover); }
.assist-btn-warn { background: var(--danger-color); color: #fff; }
.assist-btn-ghost { background: var(--surface-muted); color: var(--text-color); border: 1px solid var(--line-color); }
.assist-btn-ghost:hover:not(:disabled) { background: var(--line-color); }
.assist-btn-loading { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.assist-btn-loading:disabled { opacity: 0.85; cursor: progress; }
.assist-btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.assist-btn-loading.is-loading .assist-btn-spinner { display: inline-block; }

/* === セッション開始フロー見直し（#121） === */
/* 遅れ警告バナー（スリム・件数のみ。消化は今日のセッションに統合） */
.assist-overdue-banner {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; padding: 10px 12px;
  background: #fff5f5; border: 1px solid var(--danger-color);
  border-radius: var(--radius-md); color: var(--danger-color);
  font-size: 0.9rem; font-weight: 700;
}
.assist-overdue-banner[hidden] { display: none; }

/* 今日のToDo 概要（教科見出し＋件数・案A） */
.assist-subject-summary { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.assist-summary-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-muted); border-radius: var(--radius-sm); }
.assist-summary-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assist-summary-count { flex: none; font-size: 0.82rem; color: var(--muted-color); }
.assist-summary-count.done { color: var(--primary-color); font-weight: 700; }
.assist-summary-overdue { flex: none; background: var(--danger-color); color: #fff; border-radius: var(--radius-pill); font-size: 0.72rem; font-weight: 700; padding: 2px 9px; }

/* 教科ピッカー（ハブ＆スポーク） */
.assist-pick { padding: 4px 0; }
.assist-pick-lead { font-size: 0.95rem; color: var(--muted-color); margin: 0 0 12px; }
.assist-pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.assist-pick-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 14px 12px; background: var(--surface-muted); border: 1px solid var(--line-color); border-radius: var(--radius-md); font: inherit; text-align: left; color: inherit; cursor: pointer; }
.assist-pick-row.is-done { cursor: default; opacity: 0.7; }
.assist-pick-name { flex: 1; min-width: 0; font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* セッション中の遅れ表示 */
.assist-step-overdue { margin: 0 0 12px; padding: 6px 10px; background: #fff5f5; border-radius: var(--radius-sm); color: var(--danger-color); font-size: 0.85rem; font-weight: 700; }

/* カレンダー(読み取り専用) */
.assist-cal-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 8px; }
.assist-cal-nav button { border: 1px solid var(--line-color); background: var(--surface-muted); border-radius: var(--radius-sm); padding: 4px 12px; }
.assist-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.acal-head { text-align: center; font-size: 0.78rem; color: var(--muted-color); padding: 2px 0; }
.acal-cell { position: relative; min-height: 46px; border: 1px solid var(--line-color); border-radius: var(--radius-xs); padding: 4px 2px 18px; background: var(--surface-color); text-align: center; }
.acal-cell.out { background: var(--surface-muted); opacity: 0.5; }
.acal-cell.attend { background: var(--ui-accent-soft); }
.acal-cell.today { outline: 2px solid var(--primary-color); }
.acal-day { font-size: 0.8rem; }
.acal-dot { position: absolute; left: 50%; transform: translateX(-50%); bottom: 3px; font-size: 0.72rem; font-weight: 700; line-height: 1.4; border-radius: var(--radius-pill); padding: 0 6px; }
.acal-dot.remain { background: var(--danger-color); color: #fff; }
.acal-dot.done { background: var(--primary-color); color: #fff; }
.assist-cal-hint { margin: 8px 0 0; font-size: 0.8rem; color: var(--muted-color); }

/* アチーブメント */
.assist-stats { display: flex; gap: 8px; margin-bottom: 14px; }
.assist-stat { flex: 1; text-align: center; background: var(--surface-muted); border-radius: var(--radius-md); padding: 10px 4px; }
.assist-stat-num { display: block; font-size: 1.5rem; font-weight: 800; color: var(--primary-color); }
.assist-stat-label { font-size: 0.75rem; color: var(--muted-color); }
.assist-progress { margin-bottom: 14px; }
.assist-progress-head { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 4px; }
.assist-progress-bar { height: 10px; background: var(--line-color); border-radius: var(--radius-pill); overflow: hidden; }
.assist-progress-fill { height: 100%; width: 0; background: var(--primary-color); transition: width var(--transition); }
.assist-badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
.assist-badge { text-align: center; padding: 10px 4px; border-radius: var(--radius-md); background: var(--surface-muted); opacity: 0.55; }
.assist-badge.earned { opacity: 1; background: #fff8e1; border: 1px solid var(--ui-highlight); }
.assist-badge-icon { display: block; font-size: 1.5rem; }
.assist-badge-name { font-size: 0.72rem; line-height: 1.3; }

/* 読み込み中スケルトン（assist-mode.js#renderSkeleton） */
.assist-list-row-skeleton { height: 36px; border-radius: var(--radius-sm); }
.acal-cell-skeleton { min-height: 46px; border-radius: var(--radius-xs); }
.assist-badge-skeleton { height: 64px; border-radius: var(--radius-md); }

/* オーバーレイ共通 */
.assist-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 12px; }
.assist-overlay[hidden] { display: none; }
.assist-session { width: min(100%, 560px); max-height: 92vh; overflow-y: auto; background: var(--surface-color); border-radius: var(--radius-lg); padding: 16px; }
.assist-session-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.assist-session-progress { font-weight: 700; color: var(--muted-color); }
.assist-icon-btn { border: none; background: transparent; font-size: 1.2rem; }
.assist-session-body { margin-top: 14px; }
.assist-step-instr { color: var(--muted-color); font-size: 0.9rem; margin: 0 0 4px; }
.assist-step-title { font-size: 1.3rem; margin: 0 0 12px; color: var(--heading-color); }
.assist-step-minors { color: var(--muted-color); font-size: 0.9rem; margin: -8px 0 12px; }
.assist-step-ask { margin: 0 0 12px; }
.assist-grade-check { padding: 12px 0; border-top: 1px solid var(--ui-divider); }
.assist-grade-check:first-of-type { padding-top: 0; border-top: 0; }
.assist-check-label { margin: 0 0 8px; color: var(--ui-ink-primary); font-size: 0.95rem; font-weight: 700; }
/* 採点（◎/△/×）UI の正規クラス（#91）。アシストモードとカレンダー採点モーダルで共用する。
   個別の .assist-grade / .cal-task-grade を統合した単一の出どころ。 */
.grade-choices { display: flex; gap: 10px; margin-bottom: 12px; }
.grade-choice { flex: 1; padding: 16px 4px; font-size: 2.6rem; font-weight: 800; line-height: 1; border: 2px solid var(--line-color); border-radius: var(--radius-md); background: var(--surface-color); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.grade-choice small { font-size: 0.78rem; font-weight: 600; color: var(--muted-color); }
.grade-choice--maru { color: var(--primary-color); }
.grade-choice--sankaku { color: #b8860b; }
.grade-choice--batsu { color: var(--danger-color); }
.grade-choice.is-selected { border-color: currentColor; background: var(--surface-muted); }
.grade-choice:disabled:not(.is-selected) { opacity: 0.4; }

.assist-follow-zone { margin-top: 16px; border-top: 1px solid var(--line-color); padding-top: 12px; }
.assist-grade-check .assist-follow-zone { margin-top: 8px; border-top: 1px dashed var(--ui-divider); padding-top: 8px; }
.assist-follow-lead { font-size: 0.9rem; color: var(--muted-color); margin: 0 0 8px; }
.assist-follow-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line-color); }
.assist-follow-name { flex: 1; min-width: 0; font-size: 0.9rem; }
.assist-follow-actions { display: flex; gap: 6px; flex-shrink: 0; }
/* だるま先生 / AI Teacher ボタンは課題カレンダー側（.cal-task-follow-btn）と凡例を統一する（#226）。 */
.assist-follow-btn { border: 1px solid var(--ui-accent); color: var(--ui-accent); background: #fff; border-radius: var(--radius-sm); padding: 6px 10px; font-size: 0.8rem; cursor: pointer; }
.assist-follow-btn.ai { background: var(--ui-accent); color: #fff; }
.assist-follow-btn:disabled { opacity: 0.4; border-color: var(--line-color); color: var(--muted-color); }

/* ステップのナビ（前へ / 次へ） */
.assist-step-nav { display: flex; gap: 10px; margin-top: 16px; }
.assist-step-nav .assist-btn { width: auto; flex: 1; }
.assist-step-nav .btn { flex: 1; }
.assist-step-nav #step-prev { flex: 0 0 auto; min-width: 96px; }

/* 確認一覧（renderReview） */
.assist-review { padding: 4px 0; }
.assist-review-lead { font-size: 0.9rem; color: var(--muted-color); margin: 0 0 12px; }
.assist-review-lead.warn { color: var(--danger-color); }
.assist-review-list { list-style: none; margin: 0 0 16px; padding: 0; max-height: 50vh; overflow-y: auto; }
.assist-review-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-color); }
.assist-review-row .assist-list-title { flex: 1; min-width: 0; }
.assist-review-edit { flex-shrink: 0; border: 1px solid var(--primary-color); color: var(--primary-color); background: #fff; border-radius: var(--radius-pill); padding: 4px 12px; font-size: 0.82rem; }

/* 映像ステップ（#119） */
.assist-video-lead { margin: 0 0 12px; color: var(--ui-ink-secondary); font-size: 0.95rem; }
.assist-video-lead.muted { color: var(--ui-ink-tertiary); }
.assist-video-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.assist-video-row { padding: 0; }
.assist-video-open {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 14px 12px; background: var(--ui-surface-muted);
  border: 1px solid var(--ui-divider); border-radius: var(--radius-md);
  color: var(--ui-ink-primary); font: inherit; text-align: left;
  cursor: pointer; transition: background var(--transition), border-color var(--transition);
}
.assist-video-open:hover {
  background: var(--ui-action-soft);
  border-color: var(--ui-action);
}
.assist-video-open:focus-visible {
  outline: 2px solid var(--ui-action);
  outline-offset: 2px;
}
.assist-video-open > .bi:first-child {
  flex: none;
  color: var(--ui-action);
  font-size: 1.2rem;
}
.assist-video-open > .bi:last-child {
  flex: none;
  color: var(--ui-ink-tertiary);
}
.assist-video-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assist-video-embed { padding: 10px 0 4px; }
.assist-video-frame { position: relative; padding-top: 56.25%; }
.assist-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--radius-sm); }
.assist-video-actions { display: flex; gap: 8px; margin-top: 8px; }

/* 解説/AI Teacher は iframe モーダルではなく解説ページへ直接遷移する（#69）。 */

/* ===== 生徒カレンダー (Phase2 UI/UX改善 2026-06-11) ===== */
.student-calendar-page { max-width: var(--narrow-width); margin: 0 auto; }

.calendar-nav { display: flex; align-items: center; gap: 8px; margin: 16px 0 12px; }
.calendar-nav #month-label {
  font-weight: 700; font-size: 1.1rem; color: var(--heading-color);
  min-width: 7.5em; text-align: center;
}
.cal-nav-btn {
  width: 36px; height: 36px; flex: none;
  border: 1px solid var(--line-color); background: var(--surface-color);
  border-radius: var(--radius-sm); color: var(--primary-color);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.cal-nav-btn:hover { background: var(--surface-muted); }
.cal-today-btn {
  margin-left: auto; border: 1px solid var(--primary-color); background: var(--surface-color);
  color: var(--primary-color); border-radius: var(--radius-pill);
  font-weight: 700; font-size: 0.85rem; padding: 6px 14px; cursor: pointer;
}
.cal-today-btn:hover { background: var(--ui-accent-soft); }

.cal-notice {
  margin: 0 0 12px; padding: 10px 12px;
  border: 1px solid var(--line-color); border-radius: var(--radius-sm);
  background: var(--surface-muted); color: var(--text-color);
  font-size: 0.86rem; line-height: 1.5; white-space: pre-line;
}
.cal-notice[hidden] { display: none; }
.cal-notice.warning {
  border-color: var(--ui-highlight-ink); background: var(--ui-highlight-soft); color: var(--ui-highlight-ink);
}

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head {
  text-align: center; font-size: 0.72rem; font-weight: 700;
  color: var(--muted-color); padding-bottom: 4px;
}
.cal-cell {
  aspect-ratio: 1 / 1; display: flex; flex-direction: column; align-items: center;
  padding-top: 5px; border-radius: var(--radius-sm); background: var(--surface-color);
  border: 2px solid transparent; cursor: pointer; font-size: 0.85rem;
  color: var(--text-color); transition: background var(--transition);
}
.cal-cell:hover { background: var(--surface-muted); }
.cal-cell.out { color: var(--line-color); cursor: default; }
.cal-cell.out:hover { background: var(--surface-color); }
.cal-cell.attend { background: var(--ui-highlight-soft); }            /* 通塾日: ブランドイエローの淡色 */
.cal-cell.today { border-color: var(--primary-color); font-weight: 700; }
.cal-cell.selected { background: var(--primary-color); color: #FFFFFF; border-color: var(--primary-color); }
.cal-cell.selected.attend { background: var(--primary-color); }
.cal-day { line-height: 1.1; }
.cal-dots { display: flex; gap: 3px; margin-top: 3px; min-height: 6px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; }
.cal-dot.pending { background: var(--primary-color); }   /* 青: 未完あり */
.cal-dot.done { background: var(--ui-positive); }                   /* 緑: 全部できた */
.cal-cell.selected .cal-dot.pending { background: #FFFFFF; }
.cal-cell.selected .cal-dot.done { background: var(--ui-positive-soft); }
.cal-cell.drop-target {
  outline: 3px solid var(--primary-color);
  outline-offset: -3px;
  background: var(--ui-accent-soft);
}

/* 講師個人ボード: 学習カレンダーの遅れ強調・凡例 */
.cal-dot.overdue { background: var(--ui-danger); }
.cal-task.overdue .cal-task-meta { color: var(--ui-danger); font-weight: 600; }
.cal-legend { display: flex; gap: 12px; margin: 8px 0; font-size: 12px; color: var(--ui-ink-secondary); flex-wrap: wrap; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 4px; }

/* 面談予定（#234）: 課題ドットと別色（装飾黄）で重畳。日付パネルに別レーンで表示する。 */
.cal-dot.meeting { background: var(--ui-highlight); }
.panel-head--meetings {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px;
}
.cal-meeting {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 10px; margin-top: 8px;
  border: 1px solid var(--ui-divider); border-left: 3px solid var(--ui-highlight);
  border-radius: var(--radius-md); background: var(--ui-highlight-soft);
}
.cal-meeting-icon { color: var(--ui-highlight-ink); margin-top: 2px; flex-shrink: 0; }
.cal-meeting-body { flex: 1; min-width: 0; }
.cal-meeting-title { font-weight: 700; font-size: 0.92rem; }
.cal-meeting-notes { font-size: 0.8rem; color: var(--ui-ink-secondary); white-space: pre-wrap; }
.cal-meeting-edit {
  border: none; background: none; cursor: pointer; color: var(--ui-ink-tertiary);
  font-size: 1rem; line-height: 1; flex-shrink: 0;
}
.cal-meeting-edit:hover { color: var(--ui-accent); }
.form-field textarea {
  padding: 8px 10px; border: 1px solid var(--ui-divider); border-radius: var(--radius-sm);
  background: var(--ui-surface); color: var(--ui-ink-primary); font: inherit; resize: vertical;
}
.form-field textarea:focus-visible {
  outline: 2px solid var(--ui-accent); outline-offset: 1px; border-color: var(--ui-accent);
}
.meeting-actions { display: flex; gap: 8px; align-items: center; }
.meeting-actions .btn--block { flex: 1; width: auto; }

/* 学習カレンダー（生徒個人ボード・閲覧用）: 日毎の枠線で境目を明確化（#213）。
   生徒側ドラッグカレンダー(#178)と共有の素の .cal-cell は変えず、この修飾子配下だけ枠線を出す。
   today / selected の枠色は :not() で除外して既存の強調を維持する。 */
.calendar-grid--bordered .cal-cell:not(.today):not(.selected):not(.out) { border-color: var(--line-color); }
.calendar-grid--bordered .cal-cell.out { border-color: var(--ui-divider); }

/* 読み込み中スケルトン（student-calendar.js#renderSkeleton） */
.cal-cell-skeleton { aspect-ratio: 1 / 1; border-radius: var(--radius-sm); }
.panel-head-skeleton { height: 20px; width: 180px; margin-bottom: 12px; }
.cal-task-skeleton { height: 64px; margin-bottom: 8px; border-radius: var(--radius-md); }

.cal-day-panel { margin-top: 18px; }
.cal-day-panel .panel-head {
  font-weight: 700; color: var(--heading-color); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.cal-day-panel .attend-tag {
  background: var(--ui-highlight-soft); color: var(--ui-highlight-ink); border-radius: var(--radius-pill);
  font-size: 0.7rem; padding: 2px 9px; font-weight: 700;
}
.cal-day-panel .empty { color: var(--muted-color); font-size: 0.9rem; }

.cal-task {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line-color); border-radius: var(--radius-md);
  padding: 12px 14px; margin-bottom: 8px; background: var(--surface-color); cursor: pointer;
}
.cal-task.draggable { touch-action: none; }
.cal-task.dragging { opacity: 0.55; }
.cal-task-drag-ghost {
  position: fixed; top: 0; left: 0; z-index: 1200;
  pointer-events: none; margin: 0;
  box-shadow: var(--shadow-md); opacity: 0.96;
}
.cal-task.saving { opacity: 0.6; pointer-events: none; }   /* 保存中は二重送信防止(F3) */
.cal-task .cal-status {
  width: 24px; height: 24px; flex: none; border-radius: var(--radius-xs);
  border: 2px solid var(--line-strong); position: relative; background: var(--surface-color);
}
.cal-task.status-done .cal-status { background: var(--ui-positive); border-color: var(--ui-positive); }
.cal-task.status-done .cal-status::after {
  font-family: "bootstrap-icons"; content: "\f633"; /* bi-check-lg */
  color: #FFFFFF; font-size: 16px; line-height: 1;
  position: absolute; left: 3px; top: 3px;
}
.cal-task .cal-task-body { flex: 1; min-width: 0; }
.cal-task .cal-task-title { font-weight: 700; font-size: 0.95rem; }
.cal-task.status-done .cal-task-title { color: var(--muted-color); text-decoration: line-through; }
.cal-task-minors {
  color: var(--muted-color);
  font-size: 0.75rem;
  margin: 2px 0 0;
}
.cal-task-minors[hidden] { display: none; }
.cal-task .cal-task-meta { font-size: 0.75rem; color: var(--muted-color); }
.cal-task .cal-task-page { font-size: 0.72rem; color: var(--muted-color); }
.cal-task .cal-subject {
  background: var(--ui-accent-soft); color: var(--ui-accent-dark);
  border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 700; padding: 2px 9px; flex: none;
}
.cal-task.status-skipped { background: var(--surface-muted); border-style: dashed; cursor: default; }
.cal-task.status-skipped .cal-status { border: none; background: var(--line-color); }
.cal-task.status-skipped .cal-task-title { color: var(--muted-color); }
.cal-exempt-badge {
  background: var(--light-bg); color: var(--muted-color); border-radius: var(--radius-pill);
  font-size: 0.7rem; padding: 2px 9px; font-weight: 700; flex: none;
}
/* 教科ごとの折りたたみグループ（2教科以上のとき・#90） */
.cal-group { margin-bottom: 10px; }
.cal-group-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; background: var(--surface-muted); border: 1px solid var(--line-color);
  border-radius: var(--radius-md); cursor: pointer; font: inherit; text-align: left; color: inherit;
}
.cal-group-name { flex: 1; min-width: 0; font-weight: 700; }
.cal-group-count { flex: none; font-size: 0.78rem; color: var(--muted-color); }
.cal-group-body { margin-top: 8px; padding-left: 12px; }
.cal-group-body[hidden] { display: none; }

/* ─────────────────────────────────────────────────────────────
   講師ダッシュボード (Phase 4)
   Hallmark · pre-emit critique: P5 H4 E4 S5 R5 V4
   Hallmark · macrostructure: Stat-Led (app-adapted) · genre: modern-minimal
   · tone: utilitarian · theme: ブランドブルー踏襲(preserved) · anchor hue: cool/blue #007bc7
   · states: default · hover · focus-visible
   既存トークン(--ui-* / --primary-color など)を踏襲。dash 専用値のみ下に追加。
   ───────────────────────────────────────────────────────────── */
:root {
  --dash-width: 1100px;
  --dash-width-wide: 1600px; /* ダッシュボード専用の広め上限（#206） */
  --dash-gap: 16px;
  --dash-alert-high: var(--danger-color); /* #ba1a1a */
  --dash-alert-mid:  var(--ui-highlight-ink);             /* amber (白地で AA) */
  --dash-neutral:    var(--ui-ink-tertiary);             /* 中立"様子見" blue-grey */
  --dash-chip-high-bg: var(--ui-danger-soft);
  --dash-chip-mid-bg:  var(--ui-highlight-soft);
}

.dash-container {
  width: min(100%, var(--dash-width));
  margin: 0 auto;
  padding: 28px 24px 64px; }
/* ダッシュボードはウィンドウ幅に応じてより横長に（#206）。
   他の講師ページ（students / student-board / assignment-plans）は --dash-width 据置。 */
.dash-container--wide { width: min(100%, var(--dash-width-wide)); }
.dash-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-error {
  margin: 0 0 20px; padding: 12px 16px;
  border: 1px solid var(--dash-alert-high); border-radius: var(--radius-sm);
  background: var(--dash-chip-high-bg); color: var(--dash-alert-high);
  font-weight: 700; }
.dash-error[hidden] { display: none; }

/* KPI */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--dash-gap);
  margin-bottom: 24px; }
.dash-kpi {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px;
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-md); }
.dash-kpi--attention { border-left: 4px solid var(--dash-alert-high); }
.dash-kpi-label {
  margin: 0; color: var(--ui-ink-tertiary);
  font-size: 0.82rem; font-weight: 700; }
.dash-kpi-value {
  margin: 0; color: var(--ui-ink-primary);
  font-size: 2.1rem; font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.dash-kpi--attention .dash-kpi-value { color: var(--dash-alert-high); }
.dash-kpi-unit { font-size: 1.05rem; font-weight: 700; margin-left: 3px; }

/* 採点(◎△×)集計タリー（生徒個人ボード・#173） */
.grade-tally {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--dash-gap); }
.grade-tally-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 8px;
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-md);
  border-top: 4px solid var(--line-color); }
.grade-tally-item--maru { border-top-color: var(--ui-accent); }
.grade-tally-item--sankaku { border-top-color: var(--ui-highlight); }
.grade-tally-item--batsu { border-top-color: var(--ui-danger); }
.grade-tally-symbol { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.grade-tally-item--maru .grade-tally-symbol { color: var(--ui-accent); }
.grade-tally-item--sankaku .grade-tally-symbol { color: var(--ui-highlight); }
.grade-tally-item--batsu .grade-tally-symbol { color: var(--ui-danger); }
.grade-tally-count {
  font-size: 1.8rem; font-weight: 800; line-height: 1.1;
  color: var(--ui-ink-primary);
  font-variant-numeric: tabular-nums; }
.grade-tally-label { font-size: 0.78rem; font-weight: 700; color: var(--ui-ink-tertiary); }

/* 2カラム (要対応 | 分析) */
.dash-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--dash-gap);
  margin-bottom: 24px; }
.dash-panel {
  padding: 18px 20px;
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-md); }
.dash-panel + .dash-panel,
.dash-cols + .dash-panel { margin-top: 0; }

/* 生徒個人ボード: 各カードを均一な余白で縦積み（#213）。
   .dash-panel 同士が密着していた問題を、ページ側のスタックコンテナで解消する
   （global の .dash-panel 余白は他ページに波及するため触らない）。 */
.board-stack { display: flex; flex-direction: column; gap: var(--dash-gap); }
/* スタック直下のサマリ KPI(#board-kpis) のみ余白リセット。子孫セレクタにすると
   採点状況カード内にネストした .dash-kpis（正答率/採点済み行）の下余白まで消えるため > に限定。 */
.board-stack > .dash-kpis { margin-bottom: 0; }

/* 基本情報（生徒個人ボード・#213）: 無装飾の縦積み dl を、
   ラベル＋値でグルーピングした横並びカードへ。色・余白はトークンのみ使用。 */
.board-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 16px;
  margin: 0; }
.board-info-item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-sm); }
.board-info-key {
  margin: 0; font-size: 0.76rem; font-weight: 700;
  color: var(--ui-ink-tertiary); }
.board-info-val {
  margin: 0; font-size: 1.05rem; font-weight: 700;
  color: var(--ui-ink-primary);
  font-variant-numeric: tabular-nums; }

/* 要対応アラート */
.dash-alerts { list-style: none; margin: 0; padding: 0; }
.dash-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 0; border-top: 1px solid var(--ui-divider); }
.dash-alert:first-child { border-top: none; padding-top: 4px; }
.dash-dot {
  flex: 0 0 auto; width: 10px; height: 10px;
  margin-top: 6px; border-radius: var(--radius-pill); }
.dash-dot--high    { background: var(--dash-alert-high); }
.dash-dot--mid     { background: var(--dash-alert-mid); }
.dash-dot--neutral { background: var(--dash-neutral); }
.dash-alert-main { flex: 1 1 auto; min-width: 0; }
.dash-alert-name {
  display: block; color: var(--ui-ink-primary);
  font-weight: 800; overflow-wrap: anywhere; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.dash-chip {
  font-size: 0.78rem; font-weight: 700;
  padding: 2px 9px; border-radius: var(--radius-pill);
  background: var(--ui-surface-muted); color: var(--ui-ink-secondary); }
.dash-chip--high { background: var(--dash-chip-high-bg); color: var(--dash-alert-high); }
.dash-chip--mid  { background: var(--dash-chip-mid-bg);  color: var(--dash-alert-mid); }

/* 課題状態チップ（todo/done/skipped・表示専用／生徒側カレンダーと色味を統一） */
.dash-chip--status { display: inline-flex; align-items: center; gap: 5px; }
.dash-chip--status::before {
  content: ""; width: 8px; height: 8px; flex: none;
  border-radius: var(--radius-pill); background: currentColor; }
.dash-chip--status-todo {
  background: var(--ui-surface-muted); color: var(--ui-ink-secondary); }
.dash-chip--status-todo::before { background: transparent; border: 2px solid currentColor; }
.dash-chip--status-done { background: var(--ui-positive-soft); color: var(--ui-positive-dark); }
.dash-chip--status-done::before {
  width: auto; height: auto; background: none; border: 0;
  font-family: "bootstrap-icons"; content: "\f633"; font-size: 0.9rem; line-height: 1; }
.dash-chip--status-skipped {
  background: transparent; color: var(--ui-ink-tertiary);
  border: 1px dashed var(--line-color); }

/* 課題本体の配信状態チップ（published / draft・表示専用） */
.dash-chip--published { background: var(--ui-accent-soft); color: var(--primary-color); }
.dash-chip--draft { background: var(--ui-surface-muted); color: var(--ui-ink-tertiary); }
.dash-alert-link {
  flex: 0 0 auto; align-self: center;
  color: var(--primary-color); font-weight: 800;
  font-size: 0.9rem; white-space: nowrap;
  border-radius: var(--radius-xs); padding: 2px 4px; }
.dash-alert-link:hover { text-decoration: underline; }
.dash-alert-link:focus-visible {
  outline: 2px solid var(--primary-color); outline-offset: 2px; }
.dash-empty { color: var(--ui-ink-tertiary); padding: 14px 0; }

/* 解説未閲覧（個別生徒・中立 #217） */
.dash-unopened-lead {
  margin: 0 0 10px;
  color: var(--ui-ink-secondary);
  font-size: 0.9rem;
  font-weight: 700; }
.dash-unopened-list {
  margin: 0 0 10px;
  padding: 0;
  list-style: none; }
.dash-unopened-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 0;
  border-top: 1px solid var(--ui-divider); }
.dash-unopened-item:first-child { border-top: none; padding-top: 0; }
.dash-unopened-title {
  color: var(--ui-ink-primary);
  font-weight: 800;
  overflow-wrap: anywhere; }
.dash-unopened-meta {
  color: var(--ui-ink-tertiary);
  font-size: 0.78rem;
  white-space: nowrap; }

/* 学習行動ログ（個別生徒・直近フィード #214） */
.dash-activity-date {
  margin: 12px 0 4px;
  color: var(--ui-ink-tertiary);
  font-size: 0.78rem;
  font-weight: 800; }
.dash-activity-date:first-child { margin-top: 0; }
.dash-activity-list {
  margin: 0;
  padding: 0;
  list-style: none; }
.dash-activity-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 0;
  border-top: 1px solid var(--ui-divider); }
.dash-activity-item:first-child { border-top: none; padding-top: 0; }
.dash-activity-type {
  color: var(--ui-ink-secondary);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap; }
.dash-activity-title {
  color: var(--ui-ink-primary);
  font-weight: 800;
  overflow-wrap: anywhere; }
.dash-activity-meta {
  color: var(--ui-ink-tertiary);
  font-size: 0.78rem;
  white-space: nowrap; }

/* 分析 Coming soon */
.dash-soon-tag {
  margin-left: 8px; padding: 2px 9px;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.03em;
  color: var(--ui-ink-tertiary); background: var(--ui-surface-muted);
  border-radius: var(--radius-pill); }
.dash-soon-chart {
  display: flex; align-items: center; justify-content: center;
  min-height: 96px; margin-bottom: 10px;
  border: 1px dashed var(--line-color); border-radius: var(--radius-sm);
  color: var(--ui-ink-tertiary); font-size: 0.85rem; }
.dash-soon-row {
  display: flex; align-items: center; gap: 8px;
  color: var(--ui-ink-secondary); font-size: 0.85rem; margin-bottom: 10px; }
.dash-soon-note { margin: 0; color: var(--ui-ink-secondary); font-size: 0.78rem; }

/* 分析（クラス全体の俯瞰 #175/#207）: つまずき単元・解説閲覧ヒートマップ。
   dash-analysis-stack は指標非依存の縦積みコンテナ。カードを増減しても崩れない
   （3枚目=段階適合度の分布などを後から無改修で足せる）。 */
.dash-analysis-stack { display: flex; flex-direction: column; gap: var(--dash-gap); }
.dash-analysis-empty {
  margin: 0; padding: 6px 0; list-style: none;
  color: var(--ui-ink-tertiary); font-size: 0.82rem; }

/* つまずきやすい単元（誤答集中） */
.dash-stuck { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dash-stuck-item {
  display: grid; grid-template-columns: 1fr auto;
  grid-template-areas: "head counts" "bar bar"; gap: 4px 10px; align-items: center; }
.dash-stuck-head { grid-area: head; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.dash-stuck-name { font-weight: 800; color: var(--ui-ink-primary); overflow-wrap: anywhere; }
.dash-stuck-subject { font-size: 0.74rem; color: var(--ui-ink-tertiary); white-space: nowrap; }
.dash-stuck-bar {
  grid-area: bar; height: 8px; background: var(--ui-surface-muted);
  border-radius: var(--radius-pill); overflow: hidden; }
.dash-stuck-bar-fill { display: block; height: 100%; background: var(--dash-alert-mid); border-radius: var(--radius-pill); }
.dash-stuck-counts {
  grid-area: counts; display: flex; gap: 8px; white-space: nowrap;
  font-variant-numeric: tabular-nums; font-size: 0.82rem; font-weight: 700; }
.dash-grade--maru { color: var(--ui-accent); }
.dash-grade--sankaku { color: var(--ui-highlight); }
.dash-grade--batsu { color: var(--ui-danger); }

/* 問題段階の解説閲覧ヒートマップ（単元 × 段階） */
.dash-heatmap { overflow-x: auto; }
.dash-heatmap-table { border-collapse: collapse; font-size: 0.78rem; }
.dash-heatmap-corner,
.dash-heatmap-lv { color: var(--ui-ink-tertiary); font-weight: 700; padding: 3px 6px; text-align: center; white-space: nowrap; }
.dash-heatmap-corner { text-align: left; }
.dash-heatmap-unit {
  font-weight: 700; color: var(--ui-ink-secondary); padding: 3px 8px 3px 0;
  text-align: left; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.dash-heatmap-cell {
  width: 30px; height: 24px; text-align: center; font-weight: 700;
  color: var(--ui-ink-primary); font-variant-numeric: tabular-nums;
  border: 1px solid var(--surface-color); border-radius: var(--radius-xs);
  background: rgb(0 129 204 / calc(var(--cell, 0) * 0.8)); }

/* 生徒一覧テーブル */
.dash-table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dash-table-filters { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dash-search {
  min-height: 38px; min-width: 180px; padding: 7px 12px;
  border: 1px solid var(--line-color); border-radius: var(--radius-sm);
  background: var(--surface-color); color: var(--text-color); }
.dash-search:focus-visible {
  outline: 2px solid var(--primary-color); outline-offset: 1px;
  border-color: var(--primary-color); }
.dash-checkbox {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ui-ink-secondary); font-size: 0.9rem; font-weight: 700;
  white-space: nowrap; cursor: pointer; }
.dash-checkbox input { width: 16px; height: 16px; accent-color: var(--primary-color); }
.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.dash-table th {
  text-align: left; padding: 8px 10px; white-space: nowrap;
  color: var(--ui-ink-tertiary); font-size: 0.8rem; font-weight: 700;
  border-bottom: 2px solid var(--ui-divider); }
.dash-table td {
  padding: 10px; vertical-align: middle;
  border-bottom: 1px solid var(--ui-divider); }
.dash-table tbody tr { transition: background var(--transition); }
.dash-table tbody tr:hover { background: var(--ui-surface-muted); }
.dash-name { font-weight: 800; color: var(--ui-ink-primary); overflow-wrap: anywhere; }
.dash-num { color: var(--ui-ink-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-overdue--warn { color: var(--dash-alert-high); font-weight: 800; }
.dash-progress { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.dash-bar {
  flex: 1 1 auto; min-width: 48px; height: 6px; overflow: hidden;
  background: var(--ui-surface-muted); border-radius: var(--radius-pill); }
.dash-bar-fill { display: block; height: 100%; background: var(--primary-color); border-radius: var(--radius-pill); }
.dash-state-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.dash-row-ok { color: var(--ui-ink-tertiary); }
/* 生徒一覧テーブル（#250）：見出し・値を中央揃え。状態ラベル列だけ左揃えのまま。 */
.dash-table--center th,
.dash-table--center td { text-align: center; }
.dash-table--center .dash-progress { display: inline-flex; }
.dash-table--center th:last-child,
.dash-table--center td:last-child { text-align: left; }
.dash-row-link { cursor: pointer; }
.dash-row-link:hover { background: var(--dash-row-hover, rgba(0,0,0,0.04)); }
.dash-row-link:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }

@media (max-width: 900px) {
  .dash-cols { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-container { padding: 20px 16px 56px; } }

/* ─────────────────────────────────────────────────────────────
   講師画面: 課題の個別調整（assignment-plans）Phase C
   生徒ごとの .dash-panel カード ＋ .dash-table。状態は色ドット＋日本語セレクト。
   ───────────────────────────────────────────────────────────── */
.dash-back-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 16px; color: var(--primary-color);
  font-size: 0.9rem; font-weight: 700; border-radius: var(--radius-xs); }
.dash-back-link:hover { text-decoration: underline; }
.dash-back-link:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

.plans-head { margin-bottom: 20px; }
.plans-title {
  margin: 0 0 4px; font-size: 1.4rem; font-weight: 800;
  color: var(--ui-ink-primary); }
.plans-sub { margin: 0; color: var(--ui-ink-tertiary); font-size: 0.9rem; }
.plans-list { display: flex; flex-direction: column; gap: var(--dash-gap); }

.plan-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.plan-card-name {
  margin: 0; font-size: 1.05rem; font-weight: 800;
  color: var(--ui-ink-primary); overflow-wrap: anywhere; }
.plan-card-summary { display: flex; flex-wrap: wrap; gap: 6px; }

.plan-status-cell { display: flex; align-items: center; gap: 8px; }
.plan-status-dot {
  width: 14px; height: 14px; flex: none; border-radius: var(--radius-xs);
  border: 2px solid var(--line-color); background: transparent; position: relative; }
.plan-status-dot[data-status="done"] { background: var(--ui-positive); border-color: var(--ui-positive); }
.plan-status-dot[data-status="done"]::after {
  font-family: "bootstrap-icons"; content: "\f633"; color: #fff;
  font-size: 10px; line-height: 1; position: absolute; left: 1px; top: 1px; }
.plan-status-dot[data-status="skipped"] {
  border-style: dashed; border-color: var(--ui-ink-tertiary); background: var(--surface-muted); }

.plan-date-input,
.plan-status-select {
  min-height: 36px; padding: 5px 10px;
  border: 1px solid var(--line-color); border-radius: var(--radius-sm);
  background: var(--surface-color); color: var(--text-color);
  font-size: 0.88rem; }
.plan-date-input { font-variant-numeric: tabular-nums; }
.plan-status-select { font-weight: 700; cursor: pointer; }
.plan-date-input:focus-visible,
.plan-status-select:focus-visible {
  outline: 2px solid var(--primary-color); outline-offset: 1px;
  border-color: var(--primary-color); }

.plan-card-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; margin-top: 14px; }
.plan-saved {
  color: var(--ui-positive-dark); font-weight: 700; font-size: 0.85rem;
  display: inline-flex; align-items: center; gap: 5px;
  opacity: 0; transition: opacity var(--transition); }
.plan-saved.show { opacity: 1; }
.plan-saved::before { font-family: "bootstrap-icons"; content: "\f633"; }
.plan-error { color: var(--danger-color); font-weight: 700; font-size: 0.85rem; }

/* ─────────────────────────────────────────────────────────────
   講師画面 Phase C: 共有サイドバーシェル
   ───────────────────────────────────────────────────────────── */
html,
body {
  overflow-x: clip; }

.teacher-layout {
  display: flex;
  min-height: 100vh;
  background: var(--ui-base); }

.teacher-nav-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap; }

.teacher-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex: 0 0 var(--sidebar-width);
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 24px 16px;
  background: var(--ui-surface);
  border-right: 1px solid var(--ui-divider); }

.teacher-brand--rail,
.teacher-brand--topbar {
  color: var(--primary-color);
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere; }

.teacher-brand--rail:hover,
.teacher-brand--topbar:hover {
  color: var(--primary-color); }

.teacher-nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 24px; }

.teacher-nav-link {
  display: block;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--ui-ink-secondary);
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition); }

.teacher-nav-link:hover:not([aria-current="page"]) {
  background: var(--ui-surface-muted);
  color: var(--ui-ink-primary); }

.teacher-nav-link[aria-current="page"] {
  background: var(--nav-active-bg);
  color: var(--nav-active-ink);
  font-weight: 700; }

.teacher-nav-link:focus-visible,
.teacher-nav-logout:focus-visible,
.teacher-nav-toggle:focus-visible,
.teacher-layout:has(.teacher-nav-toggle-input:focus-visible) .teacher-nav-toggle {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px; }

.teacher-nav-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: auto;
  padding: 9px 16px;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ui-ink-secondary);
  font-weight: 700;
  transition: background var(--transition), color var(--transition); }

.teacher-nav-logout:hover {
  background: var(--ui-surface-muted);
  color: var(--ui-ink-primary); }

.teacher-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100vh;
  padding: 2rem;
  background: var(--ui-base); }

.teacher-topbar,
.teacher-nav-toggle {
  display: none; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 24px; }

.page-header__title {
  margin: 0;
  color: var(--ui-ink-primary);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere; }

.page-header__subtitle {
  margin: 0.25rem 0 0;
  color: var(--ui-ink-tertiary);
  font-size: 0.95rem; }

.page-header .primary-btn {
  margin-left: auto; }

@media (max-width: 767px) {
  .teacher-layout {
    display: block;
    min-height: 100vh; }

  .teacher-main {
    min-height: 100vh;
    padding: 0; }

  .teacher-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 57px;
    padding: 6px 16px;
    background: var(--ui-surface);
    border-bottom: 1px solid var(--ui-divider); }

  .teacher-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--ui-divider);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ui-ink-primary);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    transition: background var(--transition), color var(--transition); }

  .teacher-nav-toggle:hover {
    background: var(--ui-surface-muted); }

  .teacher-nav {
    position: fixed;
    top: 57px;
    left: 0;
    z-index: 25;
    width: 100%;
    height: auto;
    max-height: calc(100vh - 57px);
    overflow-y: auto;
    padding: 14px 16px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--ui-divider);
    display: none; }

  .teacher-nav-toggle-input:checked ~ .teacher-nav,
  .teacher-layout:has(.teacher-nav-toggle-input:checked) .teacher-nav {
    display: flex; }

  .teacher-brand--rail {
    display: none; }

  .teacher-nav-links {
    margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .teacher-nav {
    transition: none; }
}

/* ─────────────────────────────────────────────────────────────
   講師画面 Phase C: 課題管理・通塾日設定
   ───────────────────────────────────────────────────────────── */
.teacher-page-content {
  width: 100%; }

.assignment-section {
  width: 100%; }

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

.assignment-list > li {
  border-bottom: 1px solid var(--ui-divider); }

.assignment-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 -0.5rem;
  padding: 0.875rem 0.5rem;
  border-radius: var(--radius-xs);
  transition: background var(--transition); }

.assignment-row:hover {
  background: var(--ui-surface-muted); }

.assignment-list > li:not(.assignment-row) {
  padding: 0.875rem 0;
  color: var(--ui-ink-tertiary); }

.assignment-row-main {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem; }

.assignment-row-title {
  color: var(--ui-ink-primary);
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere; }

.assignment-row-title:hover {
  color: var(--primary-color); }

.assignment-row-title:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px; }

.assignment-row-meta,
.assignment-row-count {
  color: var(--ui-ink-tertiary);
  font-size: 0.9rem; }

.assignment-row-side {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.625rem;
  white-space: nowrap; }

.assignment-dialog {
  width: min(960px, calc(100vw - 2rem));
  max-height: min(86vh, 840px);
  padding: 1.5rem;
  overflow: auto;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-lg);
  background: var(--ui-surface);
  color: var(--ui-ink-primary); }

.assignment-dialog::backdrop {
  background: rgba(0, 0, 0, 0.32); }

.assignment-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem; }

.assignment-dialog-title {
  margin: 0;
  color: var(--ui-ink-primary);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35; }

.assignment-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem; }

.assignment-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--ui-ink-secondary);
  font-size: 0.9rem;
  font-weight: 700; }

.assignment-field input,
.assignment-field select {
  min-height: 44px;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-sm);
  background: var(--ui-surface);
  color: var(--ui-ink-primary); }

.assignment-field input:focus-visible,
.assignment-field select:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-color: var(--primary-color); }

.assignment-dialog-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem; }

.assignment-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap; }

.assignment-section-head h3 {
  margin: 0;
  color: var(--ui-ink-primary);
  font-size: 1rem;
  font-weight: 700; }

.node-count {
  color: var(--ui-ink-tertiary);
  font-size: 0.9rem;
  font-weight: 700; }

.node-tree,
.student-list {
  max-height: 280px;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-md);
  background: var(--ui-surface); }

.node-tree ul,
.student-list {
  list-style: none;
  margin: 0; }

.node-tree-root,
.node-tree-children {
  padding: 0; }

.node-tree-item + .node-tree-item {
  border-top: 1px solid var(--ui-divider); }

.node-tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0; }

.node-tree-row label,
.student-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  color: var(--ui-ink-secondary);
  font-size: 0.9rem; }

.node-tree-row input,
.student-check input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--primary-color); }

.student-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem; }

.dialog-actions,
.attendance-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap; }

.primary-btn,
.secondary-btn {
  min-height: 44px;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  line-height: 1.3; }

.primary-btn {
  border: 1px solid var(--primary-color); }

.primary-btn:focus-visible,
.secondary-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px; }

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.55; }

.empty-message {
  margin: 0;
  color: var(--ui-ink-tertiary);
  font-size: 0.9rem; }

.attendance-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 720px; }

.attendance-card {
  padding: 1rem 1.25rem;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-md);
  background: var(--ui-surface); }

.attendance-card-head {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-wrap: wrap; }

.attendance-name {
  color: var(--ui-ink-primary);
  font-weight: 600; }

.attendance-login {
  color: var(--ui-ink-tertiary);
  font-size: 0.9rem; }

.weekday-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0; }

.weekday-pill {
  position: relative;
  display: inline-flex; }

.weekday-pill input {
  position: absolute;
  inset: 0;
  opacity: 0; }

.weekday-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-sm);
  background: var(--ui-surface);
  color: var(--ui-ink-secondary);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition); }

.weekday-pill input:checked + span {
  border-color: var(--primary-color);
  background: var(--nav-active-bg);
  color: var(--primary-color);
  font-weight: 700; }

.weekday-pill input:focus-visible + span {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px; }

.attendance-feedback {
  color: var(--ui-ink-tertiary);
  font-size: 0.9rem; }

.attendance-feedback.is-error {
  color: var(--danger-color); }

@media (max-width: 767px) {
  .teacher-page-content {
    padding: 20px 16px 56px; }

  .page-header .primary-btn {
    width: 100%;
    margin-left: 0; }

  .assignment-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.5rem; }

  .assignment-row-side,
  .dialog-actions,
  .attendance-actions {
    justify-content: flex-start; }

  .assignment-form-grid {
    grid-template-columns: 1fr; }
}

/* ─── 生徒ホーム (student/home.html) ＋ サブページの戻りリンク ───── */
.assist-back-link { margin: 0 0 12px; font-size: 0.9rem; }
.student-home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 16px; }
.student-home-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 16px; }
.student-home-icon { font-size: 2.6rem; line-height: 1; }

/* ─── gyokan.html チャット: 旧インライン<style>を移設 ───────────────
   #chatMessages(.chat-exp-messages)配下にスコープし、既存の汎用
   .chat-msg-row / .exp-bubble 定義（ai-teacher 用）に影響させずに
   gyokan の見た目を維持する。ai-teacher は .chat-row 系を使うため非対象。 */
.chat-exp-messages .chat-msg-row {
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 8px;
  animation: bubbleFadeIn 0.25s ease-out; }
.chat-exp-messages .teacher-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 40px;
  flex-shrink: 0;
  gap: 4px; }
.chat-exp-messages .teacher-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: none; }
.chat-exp-messages .teacher-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block; }
.chat-exp-messages .teacher-avatar-placeholder {
  flex-shrink: 0;
  width: 40px; }
.chat-exp-messages .teacher-name-label {
  /* 「ときかた先生」が改行されないよう nowrap + アバター幅より広がる分は中央揃えではみ出す */
  width: max-content;
  white-space: nowrap;
  font-size: 0.6rem;
  line-height: 1.15;
  text-align: center;
  color: #666;
  font-weight: 600; }
.chat-exp-messages .bubble-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: calc(100% - 48px); }
/* 動画バブルは利用可能幅いっぱいに広げる（wrapper が縮んで動画が極小になるのを防ぐ） */
.chat-exp-messages .bubble-wrapper--video {
  width: 100%; }
.chat-exp-messages .exp-bubble.typewriting::after {
  content: '▋';
  display: inline;
  color: #007bc7;
  animation: chatCursorBlink 0.7s step-end infinite;
  font-size: 0.9em;
  margin-left: 2px; }
@keyframes chatCursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; } }
.chat-exp-messages .chat-msg-row.skipped-row {
  padding-left: 48px;
  margin-bottom: 4px; }
.chat-exp-messages .chat-msg-row.skipped-row .exp-bubble.skipped {
  width: fit-content;
  max-width: 100%; }
.chat-exp-messages .bubble-content .video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin: 0.5rem 0;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: #000; }
.chat-exp-messages .bubble-content .video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0; }

/* ─── 講師リアルタイム監視 (teacher/monitoring.html): 旧インライン<style>を移設 ───
   .mon-* / 素の .dot は monitoring 専用クラス（他ページは cal-dot 等の別名）。 */
.mon-screen {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 40px; }
.mon-title {
  margin: 0 0 18px;
  font-size: 1.55rem;
  line-height: 1.35;
  color: var(--ui-ink-primary);
  letter-spacing: 0; }
.mon-state-msg {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-sm);
  background: var(--ui-accent-soft);
  color: var(--ui-accent-dark);
  font-weight: 700; }
.mon-state-msg--error {
  border-color: var(--ui-danger);
  background: var(--ui-danger-soft);
  color: var(--ui-danger); }
.mon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; }
/* hidden 属性で確実に隠す（display:grid/grid が [hidden] を上書きするのを防ぐ） */
.mon-grid[hidden] { display: none; }
/* ── モニタリング再設計（#89） ───────────────────── */
.mon-zone { margin: 0 0 22px; }
.mon-zone[hidden] { display: none; }
.mon-zone-title { font-size: 0.95rem; font-weight: 800; color: var(--ui-ink-secondary); margin: 0 0 10px; }
.mon-zone-title--action { color: var(--ui-highlight-ink); }
.mon-card--help { border-color: var(--ui-highlight); background: var(--ui-highlight-soft); }
.mon-reason { margin-top: 8px; font-size: 0.8rem; padding: 5px 8px; border-radius: var(--radius-xs); }
.mon-reason--help { background: var(--ui-highlight-soft); border: 1px solid var(--ui-highlight); color: var(--ui-highlight-ink); font-weight: 800; }
.mon-reason--watch { background: var(--ui-accent-soft); border: 1px solid var(--ui-divider); color: var(--ui-accent-dark); font-weight: 700; }
.mon-reason--none { background: var(--ui-surface-muted); border: 1px dashed var(--line-color); color: var(--ui-ink-tertiary); }
.mon-acts { display: flex; gap: 6px; margin-top: 10px; align-items: flex-start; }
.mon-btn { font-size: 0.78rem; font-weight: 800; border-radius: var(--radius-xs); padding: 5px 10px; border: 1px solid var(--ui-divider); color: var(--ui-accent-dark); background: #fff; cursor: pointer; }
.mon-btn--primary { background: var(--ui-accent); color: #fff; border-color: var(--ui-accent); }
.mon-btn:disabled { opacity: .55; cursor: default; }
.mon-send { position: relative; }
/* 声かけドロップダウン: アイコン付きチップ（#231 デザイン準拠） */
.mon-send-menu { position: absolute; top: 112%; left: 0; z-index: 5; background: var(--ui-surface); border: 1px solid var(--ui-divider); border-radius: var(--radius-md); box-shadow: 0 10px 26px rgba(0,0,0,.16); min-width: 218px; padding: 5px; display: flex; flex-direction: column; }
.mon-send-menu[hidden] { display: none; }
.mon-send-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; min-height: 46px; padding: 8px 11px; border: none; border-radius: var(--radius-sm); background: none; font-size: 0.88rem; font-weight: 800; color: var(--ui-ink-primary); cursor: pointer; font-family: inherit; }
.mon-send-item:hover { background: var(--ui-surface-muted); }
.mon-send-icon { flex: none; width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1rem; background: var(--ui-surface-muted); color: var(--ui-ink-secondary); }
.mon-send-icon--keep { background: var(--ui-accent-soft); color: var(--ui-accent-dark); }
.mon-send-icon--good { background: var(--ui-positive-soft); color: var(--ui-positive-dark); }
.mon-send-icon--stuck { background: var(--ui-highlight-soft); color: var(--ui-highlight-ink); }
.mon-slot-ph { border: 1px dashed var(--line-color); border-radius: var(--radius-sm); background: var(--ui-surface-muted); color: var(--ui-ink-tertiary); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-size: 0.82rem; font-weight: 700; min-height: 120px; padding: 10px; }
.mon-card {
  min-height: 168px;
  padding: 16px;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-sm);
  background: var(--ui-surface);
  color: var(--ui-ink-primary); }
.mon-card.ok {
  border-color: var(--ui-positive);
  background: var(--ui-positive-soft); }
.mon-card.idle {
  border-color: var(--ui-divider);
  background: var(--ui-accent-soft); }
.mon-card.warn {
  border-color: var(--ui-highlight);
  background: var(--ui-highlight-soft); }
.mon-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 12px; }
.mon-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ui-ink-primary); }
.mon-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-pill);
  background: var(--ui-accent-soft);
  color: var(--ui-accent-dark);
  font-size: 0.8rem;
  font-weight: 800; }
.mon-label {
  min-height: 44px;
  margin: 10px 0 14px;
  color: var(--ui-ink-secondary);
  line-height: 1.55;
  overflow-wrap: anywhere; }
.mon-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ui-divider);
  color: var(--ui-ink-secondary);
  font-size: 0.92rem; }
.mon-flag {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-xs);
  background: var(--ui-accent-soft);
  font-size: 0.88rem;
  font-weight: 800; }
.mon-flag.warn {
  border-color: var(--ui-highlight);
  background: var(--ui-highlight-soft);
  color: var(--ui-highlight-ink); }
.dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid currentColor; }
.dot.online {
  color: var(--ui-positive);
  background: var(--ui-positive); }
.dot.idle {
  color: var(--ui-accent);
  background: var(--ui-accent); }
.dot.offline {
  color: var(--ui-ink-tertiary);
  background: var(--ui-ink-tertiary); }
@media (max-width: 720px) {
  .mon-screen {
    padding: 20px 16px 32px; }
  .mon-grid {
    grid-template-columns: 1fr; } }

/* ── モニタリング進捗可視化（#231） ───────────────────── */
/* ヘッダーサマリー（オンライン / 要対応 / 平均進捗） */
.mon-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin: 0 0 16px; }
.mon-header .mon-title { margin: 0; }
.mon-summary { display: flex; align-items: stretch; gap: 14px; }
.mon-summary-item { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; min-width: 46px; }
.mon-summary-num { font-size: 1.4rem; font-weight: 800; line-height: 1; color: var(--ui-ink-primary); font-variant-numeric: tabular-nums; }
.mon-summary-num--action { color: var(--ui-highlight-ink); }
.mon-summary-num--progress { color: var(--ui-positive-dark); }
.mon-summary-label { font-size: 0.7rem; font-weight: 700; color: var(--ui-ink-tertiary); }
.mon-summary-sep { width: 1px; background: var(--ui-divider); margin: 4px 0; }

/* ツールバー（簡易/詳細トグル） */
.mon-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin: 0 0 18px; background: var(--ui-surface); border: 1px solid var(--ui-divider); border-radius: var(--radius-md); }
.mon-toolbar[hidden] { display: none; }
.mon-density { display: flex; align-items: center; gap: 6px; }
.mon-density-label { font-size: 0.72rem; font-weight: 800; color: var(--ui-ink-tertiary); margin-right: 2px; }
.mon-density-btn { font-size: 0.76rem; font-weight: 800; border-radius: var(--radius-pill); padding: 5px 13px; border: 1.5px solid var(--ui-divider); background: var(--ui-surface); color: var(--ui-ink-secondary); cursor: pointer; font-family: inherit; }
.mon-density-btn[aria-pressed="true"] { background: var(--ui-accent); border-color: var(--ui-accent); color: #fff; }

/* 進捗バー（バー形状固定・#231） */
.mon-progress-row { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 0; }
.mon-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mon-progress-done { font-size: 0.8rem; font-weight: 800; color: var(--ui-ink-primary); }
.mon-progress-pct { font-size: 0.78rem; font-weight: 800; color: var(--ui-accent-dark); font-variant-numeric: tabular-nums; }
.mon-progress { height: 10px; border-radius: var(--radius-pill); background: var(--ui-surface-muted); overflow: hidden; }
.mon-progress-fill { height: 100%; background: var(--ui-accent); border-radius: inherit; transition: width 0.8s cubic-bezier(0.22, 0.61, 0.36, 1); }

/* 採点タリー（◎△×・既存色 青/黄/赤） */
.mon-tally { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 0.72rem; font-weight: 700; color: var(--ui-ink-secondary); }
.mon-tally span { white-space: nowrap; }
.mon-tally b { font-variant-numeric: tabular-nums; }
.mon-tally--maru b { color: var(--ui-accent); }
.mon-tally--sankaku b { color: var(--ui-highlight-ink); }
.mon-tally--batsu b { color: var(--ui-danger); }

/* 変化時のさりげない強調（演出・中）。要対応カードは黄背景を保つので除外。 */
@keyframes monCardFlash { 0% { background: var(--ui-accent-soft); } 100% { background: var(--ui-surface); } }
.mon-card--flash { animation: monCardFlash 1.1s ease-out; }
.mon-card--help.mon-card--flash { animation: none; }

/* 簡易表示: 問題ラベル・メタ・採点明細を畳んでカードを小さく（一覧性優先） */
.mon-screen--simple .mon-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.mon-card--simple { min-height: 0; }
.mon-card--simple .mon-label,
.mon-card--simple .mon-tally,
.mon-card--simple .mon-meta { display: none; }

@media (prefers-reduced-motion: reduce) {
  .mon-card--flash { animation: none; }
  .mon-progress-fill { transition: none; }
}

/* 生徒・右上折りたたみ help ボタン（#89） */
.help-fab { position: fixed; top: 56px; right: 0; z-index: 1200; display: flex; align-items: stretch; }
.help-fab[hidden] { display: none; }
/* chevron は help ボタンの枠線色で塗りつぶし、縦長にする（#157/#163）。展開時も常に「先生を呼ぶ」の左に置く。 */
.help-fab-chevron { width: 20px; min-height: 60px; padding: 0; background: var(--ui-highlight); color: var(--ui-highlight-ink); border: 1.5px solid var(--ui-highlight); border-radius: var(--radius-xs) 0 0 var(--radius-xs); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background var(--transition), border-color var(--transition); }
.help-fab-call { box-sizing: border-box; max-width: 9rem; min-width: 0; overflow: hidden; white-space: nowrap; background: var(--ui-highlight-soft); border: 1.5px solid var(--ui-highlight); border-left: none; color: var(--ui-highlight-ink); font-size: 0.82rem; font-weight: 800; padding: 6px 10px; display: flex; align-items: center; cursor: pointer; opacity: 1; transform: translateX(0); transition: max-width var(--transition), opacity var(--transition), padding var(--transition), border-width var(--transition), transform var(--transition); }
.help-fab.collapsed .help-fab-call { max-width: 0; padding-left: 0; padding-right: 0; border-right-width: 0; opacity: 0; transform: translateX(8px); pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .help-fab-chevron,
  .help-fab-call { transition: none; }
}

/* 生徒・「先生から」バナー（#89 / 案A #228）
   解説ヘッダー帯の直下にインフローで挿入し、本文を押し下げる（固定オーバーレイにしない）。
   表示時は帯下からスライドイン＋黄リングのフラッシュで注意を引く（Gyokan/AI Teacher 統一）。 */
.teacher-msg-area { position: relative; z-index: 1; }
.teacher-msg-area:empty { display: none; }
.tmsg-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--ui-highlight-soft);
  border-top: 2px solid var(--ui-highlight);
  border-bottom: 1px solid var(--ui-divider);
  color: var(--ui-highlight-ink);
  animation: tmsgSlide 0.5s cubic-bezier(.18,.9,.25,1.12) both, tmsgGlow 1.6s ease 0.28s 1;
}
/* 「先生」ラベル（黄ピル） */
.tmsg-who { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; background: var(--ui-highlight); color: var(--ui-highlight-ink); font-size: 0.7rem; font-weight: 800; padding: 4px 9px; border-radius: var(--radius-pill); }
/* メッセージ本文（中央を占有して両端の操作系を押し出す） */
.tmsg-q { flex: 1; min-width: 0; font-size: 0.95rem; font-weight: 700; color: var(--ui-ink-primary); }
/* 返信ボタン群 */
.tmsg-actions { display: flex; gap: 7px; flex: 0 0 auto; }
.tmsg-pill { height: 38px; padding: 0 16px; border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: background var(--transition), border-color var(--transition); }
.tmsg-pill--yes { background: var(--ui-action); color: var(--ui-surface); border: 1px solid var(--ui-action); padding: 0 17px; }
.tmsg-pill--yes:hover { background: var(--ui-action-dark); border-color: var(--ui-action-dark); }
.tmsg-pill--no { background: var(--ui-surface); color: var(--ui-ink-secondary); border: 1px solid var(--ui-divider); }
.tmsg-pill--no:hover { background: var(--ui-highlight-soft); }
.tmsg-x { flex: 0 0 auto; border: none; background: none; color: var(--ui-highlight-ink); cursor: pointer; padding: 4px; line-height: 1; }
@keyframes tmsgSlide {
  0%   { opacity: 0; transform: translateY(-16px); }
  62%  { opacity: 1; transform: translateY(3px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes tmsgGlow {
  0%, 100% { box-shadow: inset 0 0 0 0 var(--ui-highlight-ring); }
  28%      { box-shadow: inset 0 0 0 3px var(--ui-highlight-ring); }
  60%      { box-shadow: inset 0 0 0 0 var(--ui-highlight-ring); }
}
@keyframes tmsgFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .tmsg-card { animation: tmsgFade 0.3s ease both; }
  .tmsg-pill { transition: none; }
}

/* ── 課題カレンダー: 単一課題詳細モーダル（#65） ───────────────────── */
.cal-task-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5); padding: 16px;
}
.cal-task-overlay[hidden] { display: none; }
.cal-task-modal {
  background: var(--ui-surface); border-radius: var(--radius-lg); width: 100%; max-width: 420px;
  max-height: 90vh; overflow-y: auto; padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.cal-task-modal-head { display: flex; justify-content: space-between; align-items: center; }
.cal-task-subject { font-size: 0.85rem; color: var(--ui-ink-tertiary); }
.cal-task-close {
  border: none; background: none; font-size: 1.2rem; cursor: pointer; color: var(--ui-ink-tertiary); line-height: 1;
}
.cal-task-modal .cal-task-title { margin: 8px 0 16px; font-size: 1.1rem; }
.cal-task-modal .cal-task-minors { margin: -8px 0 12px; font-size: 0.85rem; }
.cal-task-instr { font-size: 0.9rem; color: var(--ui-ink-secondary); margin: 0 0 12px; }
/* 採点 UI は .grade-choices / .grade-choice（正規クラス）に統合済み（#91）。 */
.cal-task-follow-zone { margin-top: 8px; }
.cal-task-follow-lead { font-size: 0.85rem; color: var(--ui-ink-secondary); margin: 8px 0; }
.cal-task-follow-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 0; border-top: 1px solid var(--ui-divider);
}
.cal-task-follow-name { font-size: 0.9rem; }
.cal-task-follow-actions { display: flex; gap: 6px; flex-shrink: 0; }
/* フォローボタンはアシストモード(.assist-follow-btn)と同じ pill 形・配色に統一（#227） */
.cal-task-follow-btn {
  padding: 4px 12px; border: 1px solid var(--ui-accent); border-radius: var(--radius-pill);
  background: var(--ui-surface); color: var(--ui-accent); font-size: 0.82rem; cursor: pointer;
}
.cal-task-follow-btn.ai { background: var(--ui-accent); color: #fff; }
.cal-task-follow-btn:disabled { opacity: 0.5; cursor: default; }
/* 採点後に出る「次へ」導線（アシストモードの .assist-step-nav 相当） */
.cal-task-nav { margin-top: 16px; }
.cal-task-nav[hidden] { display: none; }

/* 解説画面: 戻る確認モーダル */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5); padding: 12px;
}
.confirm-modal {
  width: min(100%, 360px);
  background: var(--surface-color);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-md);
  padding: 20px;
}
.confirm-modal-message {
  margin: 0 0 18px;
  color: var(--heading-color);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
}
.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.confirm-modal-btn {
  min-width: 104px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  border: 1px solid var(--line-color);
  background: var(--surface-color);
  color: var(--text-color);
}
.confirm-modal-btn--primary {
  border-color: var(--button-primary);
  background: var(--button-primary);
  color: #fff;
}
.confirm-modal-btn--primary:hover {
  background: var(--button-hover);
  border-color: var(--button-hover);
}
.confirm-modal-btn--secondary:hover {
  background: var(--surface-muted);
}
.confirm-modal-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* =========================================================================
   正規UI部品（カノニカル・コンポーネント） — UIドリフト対策 フェーズ1 / #57
   -------------------------------------------------------------------------
   新規UIはここで定義する `.btn` / `.card` / `.chip` / `.badge` を使う。
   ・色・余白・角丸は必ず既存トークン（--ui-* / --radius-*）から引く。生hex禁止。
   ・新規に `*-btn` / `*-card` などのクラスを発明しない。
   ・既存の個別クラス（assist-btn / list-card 等）は移植フェーズ（#55）まで残す。
   一覧は public/styleguide.html、ルールは docs/components.md を参照。
   ========================================================================= */

/* --- ボタン: .btn / --primary / --secondary / --ghost ------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ui-surface-muted);
  color: var(--ui-ink-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition); }
.btn:hover { text-decoration: none; }
.btn:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px; }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed; }

.btn--primary {
  background: var(--ui-action);
  border-color: var(--ui-action);
  color: #FFFFFF; }
.btn--primary:hover:not(:disabled) {
  background: var(--ui-action-dark);
  border-color: var(--ui-action-dark);
  color: #FFFFFF; }

.btn--secondary {
  background: var(--ui-surface-muted);
  border-color: var(--ui-divider);
  color: var(--ui-ink-primary); }
.btn--secondary:hover:not(:disabled) {
  background: var(--ui-divider);
  color: var(--ui-ink-primary); }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ui-action); }
.btn--ghost:hover:not(:disabled) {
  background: var(--ui-action-soft);
  color: var(--ui-action-dark); }

/* サイズ・幅の補助モディファイア */
.btn--sm { padding: 6px 12px; font-size: 0.85rem; }
.btn--block { width: 100%; }

/* --- カード: .card / __title / __sub / __actions ----------------------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-md);
  background: var(--ui-surface);
  color: var(--ui-ink-primary); }
.card__title {
  margin: 0;
  color: var(--ui-ink-primary);
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere; }
.card__sub {
  margin: 0;
  color: var(--ui-ink-secondary);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.5; }
.card__actions {
  display: flex;
  gap: 8px;
  margin-top: 4px; }
/* クリック可能なカード（一覧の行・タイル等）に付ける */
.card--interactive {
  cursor: pointer;
  transition: border-color var(--transition); }
.card--interactive:hover {
  border-color: var(--ui-accent); }
dialog.card:not([open]) { display: none; }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  color: var(--ui-ink-secondary);
  font-size: 0.9rem;
  font-weight: 700; }
.form-field input {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--ui-divider);
  border-radius: var(--radius-sm);
  background: var(--ui-surface);
  color: var(--ui-ink-primary);
  font: inherit; }
.form-field input:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 1px;
  border-color: var(--ui-accent); }
.form-field input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  accent-color: var(--ui-action); }
.form-hint {
  color: var(--ui-ink-tertiary);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.5; }

/* --- チップ / バッジ: .chip / --accent / .badge ----------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--ui-surface-muted);
  color: var(--ui-ink-secondary);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.6; }
.chip--accent {
  background: var(--ui-accent-soft);
  color: var(--ui-accent-dark); }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  padding: 1px 7px;
  border-radius: var(--radius-xs);
  background: var(--ui-surface-muted);
  color: var(--ui-ink-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5; }
.badge--muted {
  background: var(--ui-surface-muted);
  color: var(--ui-ink-tertiary); }
.dash-table tbody tr.is-inactive {
  background: var(--ui-surface-muted);
  color: var(--ui-ink-tertiary); }

/* ─────────────────────────────────────────────────────────────
   講師ダッシュボード: 学習段階の適合度
   ───────────────────────────────────────────────────────────── */
.dash-stagefit {
  display: flex;
  flex-direction: column;
  gap: 10px; }
.dash-stagefit-caption {
  margin: 0;
  color: var(--ui-ink-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5; }
.dash-stagefit-bars {
  display: flex;
  flex-direction: column;
  gap: 7px; }
.dash-stagefit-row {
  display: grid;
  grid-template-columns: 58px minmax(84px, 1fr) 44px;
  align-items: center;
  gap: 8px; }
.dash-stagefit-label {
  color: var(--ui-ink-tertiary);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap; }
.dash-stagefit-bar {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--ui-surface-muted); }
.dash-stagefit-bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--ui-action); }
.dash-stagefit-count {
  color: var(--ui-ink-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap; }
.dash-stagefit-cell {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 52px; }
.dash-stagefit-mini {
  display: block;
  width: 52px;
  height: 4px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--ui-surface-muted); }
.dash-stagefit-mini-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--ui-ink-tertiary); }
