/* 康軒三上生字部件教學與歷程評量平台 - UDL 友善樣式 */
:root {
  --primary: #4F46E5;
  --primary-light: #EEF2FF;
  --accent: #F59E0B;
  --accent-light: #FEF3C7;
  --success: #10B981;
  --success-light: #D1FAE5;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --bg-main: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-dark: #1E293B;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "微軟正黑體", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 頂部全域導航列 */
.top-header {
  background: #FFFFFF;
  border-bottom: 2px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2rem;
  background: var(--primary-light);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1E293B;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mode-switcher {
  display: flex;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 30px;
  gap: 6px;
}

.mode-tab-btn {
  border: none;
  background: transparent;
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

/* 內容主視圖 */
.main-content {
  flex: 1;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.view-section {
  display: none;
}

.view-section.active-view {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

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

/* ================================
   模式一：課堂教學台樣式
================================ */
.lesson-nav-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}

.lesson-tab-btn {
  background: #FFFFFF;
  border: 2px solid var(--border-color);
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.lesson-tab-btn.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.teaching-header-banner {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #FFFFFF;
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.category-tag {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.char-chips-tray {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 6px;
  margin-bottom: 20px;
}

.char-item-chip {
  background: #FFFFFF;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-width: 78px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  user-select: none;
}

.char-item-chip.active {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}

.chip-char-bundle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chip-char {
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--text-dark);
  line-height: 1;
}

.chip-speaker-btn {
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  color: var(--primary);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.chip-speaker-btn:hover {
  background: var(--primary);
  color: #FFFFFF;
  transform: scale(1.15);
}

/* 雙欄主教學區 */
.teaching-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .teaching-two-col {
    grid-template-columns: 1fr;
  }
}

.card-panel {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid #F1F5F9;
  padding-bottom: 10px;
}

/* 生字主卡片 (直式注音 + 發音按鈕) */
.char-hero-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFDF9;
  padding: 18px 24px;
  border-radius: var(--radius-md);
  border: 2px dashed #CBD5E1;
  margin-bottom: 18px;
}

.hero-char-cluster {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-char-big {
  font-size: 4.8rem;
  font-weight: 900;
  line-height: 1;
  color: #0F172A;
  background: #FFFFFF;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 2px solid #E2E8F0;
}

.btn-hero-speaker {
  background: #FEF3C7;
  border: 2px solid #F59E0B;
  color: #92400E;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn-hero-speaker:hover {
  background: #F59E0B;
  color: #FFFFFF;
  transform: scale(1.1);
}

.hero-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.badge-tag {
  background: #E2E8F0;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* 部首特寫 */
.radical-spotlight {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #EFF6FF;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border-left: 6px solid #3B82F6;
  margin-bottom: 18px;
}

.radical-shape-box {
  font-size: 2.2rem;
  font-weight: 900;
  color: #1D4ED8;
  background: #FFFFFF;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.radical-desc h4 {
  font-size: 1.05rem;
  color: #1E3A8A;
}

.radical-desc p {
  font-size: 0.9rem;
  color: #3B82F6;
  font-weight: 600;
}

/* 造詞與相似字列表 */
.vocab-list, .similar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vocab-card {
  background: #F8FAFC;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
}

.vocab-word-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.vocab-word {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
}

.icon-speech-btn {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 0.95rem;
}

.vocab-sentence {
  font-size: 0.95rem;
  color: #475569;
}

.similar-card {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  padding: 12px 16px;
  border-radius: var(--radius-md);
}

.similar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.similar-char {
  font-size: 1.5rem;
  font-weight: 900;
  color: #B45309;
}

.similar-radical-tag {
  background: #F59E0B;
  color: #FFFFFF;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.similar-diff {
  font-size: 0.9rem;
  color: #92400E;
  font-weight: 700;
}

.similar-example {
  font-size: 0.9rem;
  color: #78350F;
}

/* ================================
   部件拆組工作台樣式
================================ */
.workbench-container {
  background: #F8FAFC;
  border: 2px dashed #94A3B8;
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.slots-wrapper {
  display: flex;
  gap: 16px;
  background: #E2E8F0;
  padding: 14px;
  border-radius: var(--radius-lg);
}

.slots-wrapper.layout-lr {
  flex-direction: row;
}

.slots-wrapper.layout-ud {
  flex-direction: column;
}

.assembly-slot {
  width: 90px;
  height: 90px;
  background: #FFFFFF;
  border: 3px dashed #64748B;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.assembly-slot.filled {
  border-style: solid;
  border-color: var(--primary);
  background: var(--primary-light);
}

.slot-hint {
  font-size: 0.75rem;
  color: #94A3B8;
  position: absolute;
  top: 4px;
}

.slot-content {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--text-dark);
}

.parts-tray-box {
  width: 100%;
  background: #FFFFFF;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
}

.tray-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.parts-tray-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  min-height: 56px;
}

.part-chip {
  font-size: 1.8rem;
  font-weight: 900;
  background: #F1F5F9;
  border: 2px solid #CBD5E1;
  padding: 6px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}

.part-chip:hover, .part-chip:active {
  background: var(--accent-light);
  border-color: var(--accent);
  transform: scale(1.08);
}

.workbench-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn-interactive {
  flex: 1;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 800;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-interactive.primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.btn-interactive.secondary {
  background: #E2E8F0;
  color: #334155;
}

.assembly-status {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  width: 100%;
  background: #F1F5F9;
  color: #475569;
}

.assembly-status.success {
  background: var(--success-light);
  color: #065F46;
}

.assembly-status.error {
  background: var(--danger-light);
  color: #991B1B;
}

.assembly-status.warning {
  background: var(--accent-light);
  color: #92400E;
}

/* ========================================================
   注音符號上下直式排列 (Vertical Bopomofo Typography)
   ======================================================== */
.bpmf-column {
  display: inline-flex;
  position: relative;
  line-height: 1;
  user-select: none;
  font-family: "BpmfGenSenRounded", "DFKai-SB", "BiauKai", "標楷體", "Microsoft JhengHei", sans-serif;
  vertical-align: middle;
}

.bpmf-column.standard-tone,
.bpmf-column.first-tone {
  flex-direction: row;
  align-items: center;
}

.bpmf-column.light-tone {
  flex-direction: column;
  align-items: center;
}

.bpmf-letters {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}

.bpmf-char {
  display: block;
  text-align: center;
  font-weight: 800;
  line-height: 1;
}

/* 聲調標註位置：2聲 ˊ, 3聲 ˇ, 4聲 ˋ 位於注音右手側 */
.bpmf-tone-mark {
  position: absolute;
  right: -0.75em;
  font-weight: 900;
  line-height: 1;
  color: #DC2626;
  user-select: none;
}

.bpmf-tone-mark.tone-2 {
  top: 15%;
}

.bpmf-tone-mark.tone-3 {
  top: 45%;
}

.bpmf-tone-mark.tone-4 {
  top: 20%;
}

.bpmf-tone-dot {
  font-size: 1.2em;
  line-height: 0.5;
  margin-bottom: 2px;
  color: #DC2626;
  font-weight: 900;
}

/* Hero 大字區的注音尺寸 */
.hero-bopomofo-vertical {
  display: inline-flex;
  font-size: 1.85rem;
  margin-left: 8px;
  margin-right: 14px;
}

.hero-bopomofo-vertical .bpmf-char {
  font-size: 1.85rem;
  color: #1E293B;
}

.hero-bopomofo-vertical .bpmf-tone-mark {
  font-size: 1.45rem;
  right: -0.65em;
}

/* 頂部生字列表 Chip 內的注音尺寸 */
.chip-bpmf-vert {
  display: inline-flex;
  font-size: 0.85rem;
  margin-left: 2px;
  margin-right: 6px;
}

.chip-bpmf-vert .bpmf-char {
  font-size: 0.85rem;
  color: #4338CA;
}

.chip-bpmf-vert .bpmf-tone-mark {
  font-size: 0.75rem;
  right: -0.7em;
}

/* 相似字發音按鈕 */
.similar-speaker-btn {
  background: #FFFBEB;
  border: 1px solid #F59E0B;
  color: #B45309;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 6px;
  transition: all 0.15s;
}

.similar-speaker-btn:hover {
  background: #F59E0B;
  color: #FFFFFF;
}

/* ========================================================
   整合型漢字實作工坊 (Unified Workshop Panel)
   ======================================================== */
.unified-workshop-card {
  padding: 22px;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.workshop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #F1F5F9;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.workshop-title-box {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.workshop-sub-note {
  font-size: 0.85rem;
  color: #64748B;
  font-weight: 600;
}

/* 實作工坊分頁導航 (Tab Selector) */
.workshop-nav-tabs {
  display: flex;
  gap: 10px;
  background: #F1F5F9;
  padding: 6px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.wtab-btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 800;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  color: #64748B;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.wtab-btn:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.6);
}

.wtab-btn.active {
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.workshop-tab-pane {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.workshop-tab-pane.active {
  display: block;
}

/* 筆順與手寫並排展示區 */
.writing-duo-stage {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.writing-canvas-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.writing-card-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-dark);
}

.hanzi-writer-box {
  border: 2px solid #CBD5E1;
  border-radius: 12px;
  background: #FFFDF9;
  box-shadow: var(--shadow-sm);
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tianzige-canvas {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  background: #FFFDF9;
  cursor: crosshair;
  touch-action: none;
}

.stroke-tools {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-tool {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-tool:hover {
  background: #F1F5F9;
}

/* ================================
   模式二：歷程評量遊戲島樣式
================================ */
.game-container {
  max-width: 900px;
  margin: 0 auto;
}

.lobby-card {
  background: #FFFFFF;
  padding: 36px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.lobby-hero-icon {
  font-size: 4rem;
  margin-bottom: 12px;
}

.lobby-form {
  max-width: 450px;
  margin: 24px auto 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.form-group label {
  font-weight: 700;
  font-size: 0.95rem;
  display: block;
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
}

.btn-giant-start {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  border: none;
  padding: 16px 24px;
  font-size: 1.25rem;
  font-weight: 800;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transition: all 0.2s;
  margin-top: 10px;
}

.btn-giant-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5);
}

/* 遊戲中畫面 */
.game-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #FFFFFF;
  padding: 14px 22px;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.progress-pill {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 20px;
}

.game-prompt-box {
  background: #EFF6FF;
  border-left: 6px solid #3B82F6;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #1E3A8A;
}

.game-feedback-banner {
  display: none;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 16px;
}

.game-feedback-banner.show {
  display: block;
  animation: pulse 0.3s ease-in-out;
}

.game-feedback-banner.success {
  background: var(--success-light);
  color: #065F46;
}

.game-feedback-banner.error {
  background: var(--danger-light);
  color: #991B1B;
}

/* 題型一：煉金爐 */
.game-stage-assembly {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.alchemy-furnace {
  background: linear-gradient(135deg, #1E1B4B, #312E81);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-md);
}

.furnace-header {
  font-size: 1.2rem;
  font-weight: 800;
  color: #FBBF24;
}

.alchemy-slots-row {
  display: flex;
  gap: 20px;
}

.game-slot {
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border: 3px dashed #818CF8;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.game-slot.filled {
  border-style: solid;
  border-color: #38BDF8;
  background: rgba(56, 189, 248, 0.2);
}

.game-slot .slot-tag {
  font-size: 0.75rem;
  color: #A5B4FC;
  position: absolute;
  top: 4px;
}

.game-slot .val {
  font-size: 3rem;
  font-weight: 900;
  color: #FFFFFF;
}

.game-action-btn {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFFFFF;
  border: none;
  padding: 12px 32px;
  font-size: 1.15rem;
  font-weight: 800;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.game-parts-shelf {
  background: #FFFFFF;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.shelf-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.shelf-parts-list {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.game-part-bubble {
  font-size: 2.2rem;
  font-weight: 900;
  background: #F8FAFC;
  border: 2px solid #CBD5E1;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.game-part-bubble:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  background: var(--primary-light);
}

/* 題型二：語詞快車 */
.game-stage-train {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.train-track-area {
  background: #FEF3C7;
  border: 2px dashed #F59E0B;
  border-radius: var(--radius-lg);
  padding: 24px;
}

.train-engine {
  font-size: 1.3rem;
  font-weight: 900;
  color: #92400E;
  margin-bottom: 16px;
}

.train-cars-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.train-car {
  flex: 1;
  min-width: 260px;
  background: #FFFFFF;
  border: 2px solid #FCD34D;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.car-label {
  font-size: 0.8rem;
  color: #B45309;
  font-weight: 700;
}

.car-sentence {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1E293B;
  margin: 10px 0;
}

.car-slot-box {
  width: 60px;
  height: 60px;
  background: #F1F5F9;
  border: 2px dashed #94A3B8;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
}

.train-car.filled .car-slot-box {
  background: var(--primary-light);
  border: 2px solid var(--primary);
}

.train-coins-shelf {
  background: #FFFFFF;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.coins-list {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.game-char-coin {
  font-size: 2.2rem;
  font-weight: 900;
  background: #FEF3C7;
  border: 3px solid #F59E0B;
  padding: 10px 26px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.game-char-coin:hover {
  transform: scale(1.1);
}

/* 結果畫面 */
.result-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.result-trophy {
  font-size: 4rem;
  margin-bottom: 12px;
}

.result-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.res-stat-box {
  background: #F8FAFC;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
}

.res-stat-val {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary);
}

.res-stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.iep-diagnostic-box {
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: left;
  margin-bottom: 24px;
}

.iep-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #92400E;
  margin-bottom: 10px;
}

.diagnostic-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diag-tag {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.diag-tag.green {
  background: var(--success-light);
  color: #065F46;
}

.diag-tag.orange {
  background: #FEF3C7;
  color: #92400E;
}

.upload-sync-bar {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-weight: 600;
}

.result-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
}

/* ================================
   模式三：教師診斷儀表板
================================ */
.dashboard-container {
  max-width: 1100px;
  margin: 0 auto;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.stat-cards-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 180px;
  background: #FFFFFF;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.stat-card.wide {
  flex: 2;
  min-width: 320px;
}

.stat-val {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
}

.stat-sub {
  margin-top: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #B45309;
}

.dashboard-actions-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-export-excel {
  background: #10B981 !important;
  color: #FFFFFF !important;
  font-weight: 800 !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35) !important;
  transition: all 0.2s !important;
}

.btn-export-excel:hover {
  background: #059669 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45) !important;
}

.records-list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.record-row-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 2fr 1fr 2.5fr auto;
  gap: 16px;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.record-row-card:hover {
  border-color: #CBD5E1;
  box-shadow: var(--shadow-md);
}

@media (max-width: 900px) {
  .record-row-card {
    grid-template-columns: 1fr;
  }
}

.record-student {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark);
}

.record-lesson {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.record-tag {
  background: #EEF2FF;
  color: #4338CA;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.record-score {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--success);
}

.record-time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.error-summary-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
}

.error-summary-content {
  font-size: 0.9rem;
  color: #334155;
  font-weight: 600;
}

.btn-delete-record {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FCA5A5;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.btn-delete-record:hover {
  background: #EF4444;
  color: #FFFFFF;
  border-color: #DC2626;
  transform: scale(1.05);
}

/* ================================
   教育部筆順學習網彈出視窗 (Modal)
================================ */
.moe-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.moe-modal-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1050px;
  height: 90vh;
  max-height: 820px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.moe-modal-header {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #FFFDF9;
  border-bottom: 2px solid var(--border-color);
}

.moe-modal-body {
  flex: 1;
  background: #F8FAFC;
  padding: 10px;
}
