@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 {
  --primary-color: #004e9f;
  --secondary-blue: #0066cc;
  --accent-color: #004e9f;
  --button-primary: #004e9f;
  --button-hover: #00458e;
  --bg-color: #FFFFFF;
  --light-bg: #f3f4f5;
  --text-color: #191c1d;
  --heading-color: #004e9f;
  --surface-color: #FFFFFF;
  --surface-muted: #f8f9fa;
  --line-color: #c1c6d5;
  --line-strong: #727784;
  --muted-color: #414753;
  --success-color: #414753;
  --danger-color: #ba1a1a;
  --warning-color: #ba1a1a;
  --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;
  /* ─── ITTO chat (gyokan/ai-teacher) 用カラーパレット ─────────
     参考: ITTO 公式サイトのブランド色（オレンジ CTA・ティール CTA・ゴールド装飾線）
     :root の既存値は他画面共有のため触らず、chat-exp 関連 selector でのみ使用 */
  --itto-teal:          #004e9f;
  --itto-teal-soft:     #d7e3ff;
  --itto-teal-dark:     #00458e;
  --itto-orange:        #004e9f;
  --itto-orange-soft:   #d7e3ff;
  --itto-orange-dark:   #00458e;
  --itto-gold:          #727784;
  /* 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;
  --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(--secondary-blue); }
img,
svg,
video,
iframe {
  max-width: 100%; }
.main-content {
  min-height: calc(100vh - 64px);
  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: 64px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line-color);
  backdrop-filter: blur(10px); }
.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; }
.app-title {
  color: var(--heading-color);
  font-weight: 800;
  font-size: 1.08rem;
  line-height: 1.3; }
.app-title:hover {
  color: var(--heading-color); }
.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(--primary-color);
  border-radius: var(--radius-pill);
  background: rgba(0, 78, 159, 0.08);
  font-size: 1.3rem;
  font-weight: 800; }
.material-leaf-card .list-card-arrow {
  color: var(--accent-color);
  background: rgba(0, 78, 159, 0.12); }
.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: #d7e3ff; }
.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; }
/* .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, 78, 159, 0.14); }
.stage-option-btn.active {
  background: #d7e3ff; }
.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 - 64px);
  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; }
.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, 78, 159, 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, 78, 159, 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: 0 4px 16px rgba(20, 22, 28, 0.08);
  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, 78, 159, 0.4);
  background: #FFFFFF;
  color: #004e9f;
  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, 78, 159, 0.06); }
.chat-complete-btn:active {
  transform: scale(0.98); }
.chat-complete-btn.primary {
  background: #004e9f;
  border-color: #004e9f;
  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 (Gyokan / AI-teacher) */
.material-leaf-actions {
  display: flex;
  gap: 8px;
}
.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: 600;
  white-space: nowrap;
}
.mode-btn--gyokan {
  background: var(--itto-teal);
  color: #fff;
}
.mode-btn--ai-teacher {
  background: var(--itto-orange);
  color: #fff;
}
.mode-btn--gyokan:hover { background: var(--itto-teal-dark); color:#fff; }
.mode-btn--ai-teacher:hover { background: var(--itto-orange-dark); color:#fff; }
.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, #004e9f);
  margin-bottom: 8px;
}
.gyokan-video-card {
  background: var(--light-bg, #f3f4f5);
  border-left: 4px solid var(--accent-color, #004e9f);
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 4px;
}

@media (max-width: 480px) {
  .material-leaf-actions { flex-direction: row; }
  .mode-btn { width: 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 - 64px);
  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: 120px;
  box-shadow: var(--itto-shadow-1);
  border: 1px solid var(--itto-divider);
}

.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, 78, 159, 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, 78, 159, 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;
}
