@view-transition {
  navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 240ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
:root {
  /* 明光義塾パンフレット(book.pdf)実測準拠カラー:
     ブランド青#0081CC / 濃紺#005B96 / シアン#00AFEC / 淡青#DCEFF9 / 黄#FBC400 / 白#FFFFFF / 墨#333333 */
  --primary-color: #0081CC;
  --secondary-blue: #00AFEC;
  --accent-color: #0081CC;
  --button-primary: #0081CC;
  --button-hover: #00669F;
  --bg-color: #FFFFFF;
  --light-bg: #F2F4F7;
  --text-color: #333333;
  --heading-color: #005B96;
  --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-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --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) 用カラーパレット ─────────
     明光版: CTA は青 #0081CC 系・装飾アクセントのみ黄 #FBC400（パンフレット book.pdf 準拠）
     変数名は itto 版からの流用（一括リネームを避けるため名前は維持） */
  --itto-teal:          #0081CC;
  --itto-teal-soft:     #DCEFF9;
  --itto-teal-dark:     #00669F;
  --itto-orange:        #0081CC;
  --itto-orange-soft:   #DCEFF9;
  --itto-orange-dark:   #00669F;
  --itto-gold:          #FBC400;
  /* base = ニュートラルオフホワイト (クール系、node-prod 寄り) */
  --itto-ivory:         #f8f9fa;
  --itto-surface:       #FFFFFF;
  --itto-surface-muted: #edeeef;
  --itto-divider:       #e7e8e9;
  --itto-ink-primary:   #191c1d;
  --itto-ink-secondary: #414753;
  --itto-ink-tertiary:  #727784;
  --itto-success:       #414753;
  --itto-shadow-1:      none;
  --sidebar-width:      240px;
  --nav-active-bg:      var(--itto-teal-soft);
  --nav-active-ink:     var(--primary-color);
  --itto-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%; }
.main-content {
  min-height: calc(100vh - 54px);
  animation: pageFadeIn 240ms cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px); }
  to {
    opacity: 1;
    transform: translateY(0); } }
.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(--itto-gold);
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: 1.3rem;
  font-weight: 800; }
.material-leaf-card .list-card-arrow {
  color: var(--itto-gold);
  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 版踏襲 + ITTO 色 ─── */
.chat-exp-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 54px);
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 0;
  background: var(--itto-ivory); }
.chat-exp-header {
  background: var(--itto-surface);
  color: var(--itto-ink-primary);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid var(--itto-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(--itto-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(--itto-teal);
  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(--itto-ink-primary); }
.chat-exp-title span {
  font-size: 0.78rem;
  color: var(--itto-ink-secondary); }
.chat-exp-level-bar {
  background: var(--itto-surface);
  border: none;
  border-bottom: 1px solid var(--itto-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(--itto-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(--itto-divider);
  background: var(--itto-surface-muted);
  color: var(--itto-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(--itto-orange);
  color: var(--itto-orange);
  background: var(--itto-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(--itto-orange);
  color: #FFFFFF;
  border-color: var(--itto-orange);
  box-shadow: none; }
/* level-bar とチャット画面の間に置く細いプログレスバー（主張は控えめ） */
.chat-progress-line {
  height: 2px;
  background: var(--itto-divider);
  flex-shrink: 0;
  overflow: hidden; }
.chat-progress-line-fill {
  height: 100%;
  width: 0%;
  background: var(--itto-orange);
  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(--itto-ivory);
  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(--itto-divider); border-radius: 4px; }
.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: 12px;
  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(--itto-surface);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
  border-top-left-radius: 12px;
  box-shadow: var(--itto-shadow-1);
  border: 1px solid var(--itto-divider);
  color: var(--itto-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(--itto-surface);
  border-bottom-color: var(--itto-surface); }
/* 送信バブル（ai-teacher 用、ITTO 既存色維持） */
.exp-bubble.sent {
  color: #FFFFFF;
  background: var(--primary-color);
  border-color: var(--primary-color);
  border-top-right-radius: 4px;
  align-self: flex-end; }
/* typewriter カーソル (ITTO オレンジ) */
.exp-bubble.typewriting::after {
  content: "|";
  display: inline-block;
  margin-left: 2px;
  color: var(--itto-orange);
  animation: cursorBlink 0.7s step-end infinite; }
@keyframes cursorBlink {
  50% {
    opacity: 0; } }
/* bubble-content 装飾（node-prod 版踏襲 + ITTO 色） */
.bubble-content { color: var(--itto-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(--itto-ink-primary);
  font-size: 0.95rem; }
.bubble-content strong { font-weight: 700; color: var(--itto-ink-primary); }
.bubble-content em { font-style: italic; color: var(--itto-ink-secondary); }
.bubble-content code {
  background: var(--itto-surface-muted);
  padding: 0.1em 0.3em;
  border-radius: 4px;
  font-size: 0.88em;
  border: 1px solid var(--itto-divider); }
.bubble-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 0.5rem 0;
  box-shadow: var(--itto-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(--itto-divider);
  color: var(--itto-ink-secondary); }
.bubble-time {
  font-size: 0.7rem;
  color: var(--itto-ink-tertiary);
  text-align: right;
  margin-top: 0.4rem; }
.bubble-level-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 0.4rem;
  background: var(--itto-success);
  white-space: nowrap; }
.bubble-level-badge[data-level="-1"] { background: var(--itto-gold); }
.bubble-level-badge[data-level="-2"] { background: var(--itto-orange); }
.bubble-level-badge[data-level="-3"] { background: var(--itto-orange-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(--itto-divider);
  border-bottom-left-radius: 3px;
  border-top-left-radius: 12px;
  color: var(--itto-ink-secondary);
  background: var(--itto-surface-muted);
  align-self: flex-start;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition); }
.exp-bubble.skipped:hover {
  background: var(--itto-divider);
  border-color: var(--itto-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(--itto-surface-muted);
  border-bottom-color: var(--itto-surface-muted); }
.skipped-indicator {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--itto-ink-secondary);
  font-size: 0.82rem;
  line-height: 1.25;
  white-space: nowrap; }
.skipped-dots {
  font-size: 1rem;
  letter-spacing: 2px;
  color: var(--itto-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(--itto-ink-tertiary);
  font-weight: 600; }
.skipped-tag {
  display: inline-block;
  background: var(--itto-surface);
  color: var(--itto-ink-primary);
  padding: 0.1rem 0.5rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--itto-divider); }
.tap-hint-text {
  font-size: 0.68rem;
  color: var(--itto-orange);
  margin-left: auto;
  font-weight: 700; }
/* 展開済みバブル（オレンジ soft 背景 + オレンジしっぽ） */
.exp-bubble.expanded {
  background: var(--itto-orange-soft);
  box-shadow: var(--itto-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(--itto-orange-soft);
  border-bottom-color: var(--itto-orange-soft); }
.expanded-header {
  font-size: 0.75rem;
  color: var(--itto-orange);
  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: 14px; }
.skeleton-chat-bubble.short {
  width: min(54%, 360px); }
.chat-exp-footer {
  background: var(--itto-surface);
  padding: 0.5rem 1rem;
  flex-shrink: 0;
  border-top: 1px solid var(--itto-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(--itto-ink-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap; }
.tap-icon-anim {
  display: inline-block;
  font-size: 1.05rem;
  color: var(--itto-orange);
  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: 20px;
  color: var(--itto-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: 16px;
  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: #0081CC;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  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: #0081CC;
  border-color: #0081CC;
  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(--itto-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(--itto-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(--itto-teal), var(--itto-gold));
  transition: width 180ms ease; }
.chat-progress-text {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: var(--itto-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 (ダルマ先生解説 / 個別最適解説プラス10®) — 配色は PHP 版 meiko 準拠 */
.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: 999px;
  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: 8px;
  padding: 16px;
  margin-bottom: 12px;
}
.gyokan-card-header {
  font-weight: bold;
  color: var(--heading-color, #0081CC);
  margin-bottom: 8px;
}
.gyokan-video-card {
  background: var(--light-bg, #f3f4f5);
  border-left: 4px solid var(--accent-color, #0081CC);
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 4px;
}

/* 狭い画面では番号の上・ボタン下の縦積みに切り替え（ボタン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 + ITTO 色 ─────────── */
:root {
  --itto-danger: #ba1a1a;
}

.empty-message {
  color: var(--itto-ink-secondary);
  text-align: center;
  padding: 2.5rem;
  font-size: 0.95rem;
  background: var(--itto-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--itto-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(--itto-ivory);
}

.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(--itto-surface);
  border-bottom: 1px solid var(--itto-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(--itto-ivory);
}

.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(--itto-surface);
  box-shadow: var(--itto-shadow-2);
  border: 1px solid var(--itto-divider);
  border-left: 3px solid var(--itto-orange);
  border-bottom-left-radius: var(--radius-sm);
  color: var(--itto-ink-primary);
}

/* AI 解説のタイプライター表示（gyokan 踏襲）。cursorBlink キーフレームは共通。 */
.chat-card.typewriting::after {
  content: "|";
  display: inline-block;
  margin-left: 2px;
  color: var(--itto-orange);
  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(--itto-orange);
  color: #FFFFFF;
  box-shadow: var(--itto-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(--itto-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(--itto-shadow-1);
  border: 1px solid var(--itto-divider);
}

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

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

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

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

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

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

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

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

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

.chat-card blockquote {
  border-left: 3px solid var(--itto-orange);
  padding: 0.5rem 0.75rem 0.5rem 0.875rem;
  color: var(--itto-ink-secondary);
  margin: 0.5rem 0;
  font-style: italic;
  background: var(--itto-orange-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(--itto-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(--itto-divider);
  border-top-color: var(--itto-orange);
}

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

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

.typing-label {
  color: var(--itto-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(--itto-orange);
  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(--itto-surface);
  border-top: 1px solid var(--itto-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(--itto-surface-muted);
  border: 1px solid var(--itto-divider);
  border-radius: var(--radius-pill);
  color: var(--itto-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(--itto-orange-soft);
    border-color: var(--itto-orange);
    color: var(--itto-orange);
  }
}

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

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

.hint-btn {
  color: var(--itto-gold);
  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(--itto-gold);
    color: var(--itto-gold);
  }
}

.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(--itto-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(--itto-surface);
  color: var(--itto-ink-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 40px;
  max-height: 120px;
}

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

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

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

.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.35rem;
  background: var(--itto-orange);
  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(--itto-orange-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(--itto-surface);
  border-top: 1px solid var(--itto-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(--itto-orange);
  color: #FFFFFF;
  box-shadow: none;
}

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

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

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

.secondary-btn:hover {
  background: var(--itto-divider);
  color: var(--itto-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(--itto-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(--itto-danger);
}

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

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

.chat-history::-webkit-scrollbar-thumb {
  background: var(--itto-divider);
  border-radius: 4px;
}

.chat-history::-webkit-scrollbar-thumb:hover {
  background: var(--itto-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(--itto-surface);
  border: 1px solid var(--itto-divider);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--itto-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(--itto-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(--itto-divider);
  border-radius: var(--radius-sm);
  background-color: var(--itto-surface);
  color: var(--itto-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(--itto-orange);
  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(--itto-orange);
  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(--itto-orange-dark);
}

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

.stage-select-note {
  margin: 0;
  color: var(--itto-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 {
  justify-content: center;
}

.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;
  animation: logoFloat 1.9s ease-in-out infinite;
  transform-origin: center;
}

.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(--itto-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-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;
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.92;
  }
  50% {
    transform: translateY(-6px) scale(1.02);
    opacity: 1;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .loading-logo {
    animation: none;
  }
}

/* ─── アシストモード (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(--itto-gold); color: #000; }
.assist-chip.grade-batsu { background: var(--danger-color); color: #fff; }

.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-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: 42px; border: 1px solid var(--line-color); border-radius: var(--radius-xs); padding: 2px 4px; background: var(--surface-color); }
.acal-cell.out { background: var(--surface-muted); opacity: 0.5; }
.acal-cell.attend { background: var(--itto-teal-soft); }
.acal-cell.today { outline: 2px solid var(--primary-color); }
.acal-day { font-size: 0.78rem; }
.acal-dot { position: absolute; right: 3px; bottom: 2px; font-size: 0.72rem; font-weight: 700; border-radius: var(--radius-pill); padding: 0 5px; }
.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(--itto-gold); }
.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: 42px; 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-ask { margin: 0 0 12px; }
.assist-grades { display: flex; gap: 10px; }
.assist-grade { flex: 1; padding: 16px 4px; font-size: 1.8rem; font-weight: 800; border: 2px solid var(--line-color); border-radius: var(--radius-md); background: var(--surface-color); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.assist-grade small { font-size: 0.72rem; font-weight: 600; color: var(--muted-color); }
.assist-grade.g-maru { color: var(--primary-color); }
.assist-grade.g-sankaku { color: #b8860b; }
.assist-grade.g-batsu { color: var(--danger-color); }
.assist-grade.selected { border-color: currentColor; background: var(--surface-muted); }
.assist-grade:disabled:not(.selected) { opacity: 0.4; }

.assist-follow-zone { margin-top: 16px; border-top: 1px solid var(--line-color); padding-top: 12px; }
.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; }
.assist-follow-btn { border: 1px solid var(--primary-color); color: var(--primary-color); background: #fff; border-radius: var(--radius-pill); padding: 4px 12px; font-size: 0.82rem; }
.assist-follow-btn.ai { background: var(--primary-color); 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 #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; }

/* 解説/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(--itto-teal-soft); }

.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: #FCF3CC; }            /* 通塾日: 明光イエローの淡色 */
.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: #2E9E5B; }                   /* 緑: 全部できた */
.cal-cell.selected .cal-dot.pending { background: #FFFFFF; }
.cal-cell.selected .cal-dot.done { background: #CFF3DC; }

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

/* 読み込み中スケルトン（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: #FCF3CC; color: #8A6D00; 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.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-in_progress .cal-status {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, var(--primary-color) 0 50%, var(--surface-color) 50% 100%);
}
.cal-task.status-done .cal-status { background: #2E9E5B; border-color: #2E9E5B; }
.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 .cal-task-meta { font-size: 0.75rem; color: var(--muted-color); }
.cal-task .cal-subject {
  background: var(--itto-teal-soft); color: var(--itto-teal-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;
}

/* ─────────────────────────────────────────────────────────────
   講師ダッシュボード (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 #0081CC
   · states: default · hover · focus-visible
   既存トークン(--itto-* / --primary-color など)を踏襲。dash 専用値のみ下に追加。
   ───────────────────────────────────────────────────────────── */
:root {
  --dash-width: 1100px;
  --dash-gap: 16px;
  --dash-alert-high: var(--danger-color); /* #ba1a1a */
  --dash-alert-mid:  #B26A00;             /* amber (白地で AA) */
  --dash-neutral:    #5B6B7B;             /* 中立"様子見" blue-grey */
  --dash-chip-high-bg: #fbe9e9;
  --dash-chip-mid-bg:  #fdf1e0;
}

.dash-container {
  width: min(100%, var(--dash-width));
  margin: 0 auto;
  padding: 28px 24px 64px; }
.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(--itto-ink-tertiary);
  font-size: 0.82rem; font-weight: 700; }
.dash-kpi-value {
  margin: 0; color: var(--itto-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; }

/* 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; }

/* 要対応アラート */
.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(--itto-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(--itto-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(--itto-surface-muted); color: var(--itto-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/in_progress/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(--itto-surface-muted); color: var(--itto-ink-secondary); }
.dash-chip--status-todo::before { background: transparent; border: 2px solid currentColor; }
.dash-chip--status-in_progress { background: var(--itto-teal-soft); color: var(--primary-color); }
.dash-chip--status-done { background: #e4f4ea; color: #1f7a44; }
.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(--itto-ink-tertiary);
  border: 1px dashed var(--line-color); }

/* 課題本体の配信状態チップ（published / draft・表示専用） */
.dash-chip--published { background: var(--itto-teal-soft); color: var(--primary-color); }
.dash-chip--draft { background: var(--itto-surface-muted); color: var(--itto-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(--itto-ink-tertiary); padding: 14px 0; }

/* 分析 Coming soon */
.dash-soon-tag {
  margin-left: 8px; padding: 2px 9px;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.03em;
  color: var(--itto-ink-tertiary); background: var(--itto-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(--itto-ink-tertiary); font-size: 0.85rem; }
.dash-soon-row {
  display: flex; align-items: center; gap: 8px;
  color: var(--itto-ink-secondary); font-size: 0.85rem; margin-bottom: 10px; }
.dash-soon-note { margin: 0; color: var(--itto-ink-secondary); font-size: 0.78rem; }

/* 生徒一覧テーブル */
.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(--itto-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(--itto-ink-tertiary); font-size: 0.8rem; font-weight: 700;
  border-bottom: 2px solid var(--itto-divider); }
.dash-table td {
  padding: 10px; vertical-align: middle;
  border-bottom: 1px solid var(--itto-divider); }
.dash-table tbody tr { transition: background var(--transition); }
.dash-table tbody tr:hover { background: var(--itto-surface-muted); }
.dash-name { font-weight: 800; color: var(--itto-ink-primary); overflow-wrap: anywhere; }
.dash-num { color: var(--itto-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(--itto-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(--itto-ink-tertiary); }
.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(--itto-ink-primary); }
.plans-sub { margin: 0; color: var(--itto-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(--itto-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="in_progress"] {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, var(--primary-color) 0 50%, var(--surface-color) 50% 100%); }
.plan-status-dot[data-status="done"] { background: #2E9E5B; border-color: #2E9E5B; }
.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(--itto-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: #1f7a44; 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(--itto-ivory); }

.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(--itto-surface);
  border-right: 1px solid var(--itto-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(--itto-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(--itto-surface-muted);
  color: var(--itto-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(--itto-divider);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--itto-ink-secondary);
  font-weight: 700;
  transition: background var(--transition), color var(--transition); }

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

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

.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(--itto-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(--itto-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(--itto-surface);
    border-bottom: 1px solid var(--itto-divider); }

  .teacher-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--itto-divider);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--itto-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(--itto-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(--itto-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(--itto-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(--itto-surface-muted); }

.assignment-list > li:not(.assignment-row) {
  padding: 0.875rem 0;
  color: var(--itto-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(--itto-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(--itto-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(--itto-divider);
  border-radius: var(--radius-lg);
  background: var(--itto-surface);
  color: var(--itto-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(--itto-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(--itto-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(--itto-divider);
  border-radius: var(--radius-sm);
  background: var(--itto-surface);
  color: var(--itto-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(--itto-ink-primary);
  font-size: 1rem;
  font-weight: 700; }

.node-count {
  color: var(--itto-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(--itto-divider);
  border-radius: var(--radius-md);
  background: var(--itto-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(--itto-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(--itto-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(--itto-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(--itto-divider);
  border-radius: var(--radius-md);
  background: var(--itto-surface); }

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

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

.attendance-login {
  color: var(--itto-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(--itto-divider);
  border-radius: var(--radius-sm);
  background: var(--itto-surface);
  color: var(--itto-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(--itto-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: #0081CC;
  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: 6px;
  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: #12304f;
  letter-spacing: 0; }
.mon-state-msg {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #b9d7ee;
  border-radius: 8px;
  background: #eef8ff;
  color: #234660;
  font-weight: 700; }
.mon-state-msg--error {
  border-color: #e9b8b8;
  background: #fff5f5;
  color: #913333; }
.mon-banner {
  display: grid;
  gap: 8px;
  margin: 0 0 16px; }
.mon-alert {
  padding: 12px 14px;
  border: 1px solid #b9d7ee;
  border-radius: 8px;
  background: #eef8ff;
  color: #1f4664;
  font-weight: 700; }
.mon-alert--warn {
  border-color: #e7c66d;
  background: #fff9e8;
  color: #6f5200; }
.mon-alert--idle {
  border-color: #b9d7ee;
  background: #eef8ff;
  color: #1f4664; }
.mon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; }
.mon-card {
  min-height: 168px;
  padding: 16px;
  border: 1px solid #b9d7ee;
  border-radius: 8px;
  background: #f7fcff;
  color: #1d3550; }
.mon-card.ok {
  border-color: #a9d8c0;
  background: #f3fff8; }
.mon-card.idle {
  border-color: #b9d7ee;
  background: #eef8ff; }
.mon-card.warn {
  border-color: #e7c66d;
  background: #fff9e8; }
.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: #12304f; }
.mon-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid #9ec8e4;
  border-radius: 999px;
  background: #eef8ff;
  color: #1f4664;
  font-size: 0.8rem;
  font-weight: 800; }
.mon-label {
  min-height: 44px;
  margin: 10px 0 14px;
  color: #244a66;
  line-height: 1.55;
  overflow-wrap: anywhere; }
.mon-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 12px;
  border-top: 1px solid #d1e5f3;
  color: #4d6579;
  font-size: 0.92rem; }
.mon-flag {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #b9d7ee;
  border-radius: 6px;
  background: #eef8ff;
  font-size: 0.88rem;
  font-weight: 800; }
.mon-flag.warn {
  border-color: #e7c66d;
  background: #fff9e8;
  color: #6f5200; }
.dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  border: 1px solid currentColor; }
.dot.online {
  color: #188652;
  background: #188652; }
.dot.idle {
  color: #2275a6;
  background: #2275a6; }
.dot.offline {
  color: #8b98a5;
  background: #8b98a5; }
@media (max-width: 720px) {
  .mon-screen {
    padding: 20px 16px 32px; }
  .mon-grid {
    grid-template-columns: 1fr; } }

/* ── 課題カレンダー: 単一課題詳細モーダル（#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.45); padding: 16px;
}
.cal-task-overlay[hidden] { display: none; }
.cal-task-modal {
  background: #fff; border-radius: 12px; 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: #666; }
.cal-task-close {
  border: none; background: none; font-size: 1.2rem; cursor: pointer; color: #666; line-height: 1;
}
.cal-task-modal .cal-task-title { margin: 8px 0 16px; font-size: 1.1rem; }
.cal-task-instr { font-size: 0.9rem; color: #555; margin: 0 0 12px; }
.cal-task-grades { display: flex; gap: 8px; margin-bottom: 12px; }
.cal-task-grade {
  flex: 1; padding: 12px 4px; border: 2px solid #ddd; border-radius: 10px; background: #fff;
  font-size: 1.4rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.cal-task-grade small { font-size: 0.7rem; color: #666; }
.cal-task-grade.selected { border-color: var(--primary-color, #0081CC); background: var(--itto-teal-soft, #DCEFF9); }
.cal-task-grade:disabled { opacity: 0.6; cursor: default; }
.cal-task-follow-zone { margin-top: 8px; }
.cal-task-follow-lead { font-size: 0.85rem; color: #555; 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 #eee;
}
.cal-task-follow-name { font-size: 0.9rem; }
.cal-task-follow-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cal-task-follow-btn {
  padding: 6px 10px; border: 1px solid var(--primary-color, #0081CC); border-radius: 8px;
  background: #fff; color: var(--primary-color, #0081CC); font-size: 0.8rem; cursor: pointer;
}
.cal-task-follow-btn.ai { background: var(--primary-color, #0081CC); color: #fff; }
.cal-task-follow-btn:disabled { opacity: 0.5; cursor: default; }
