:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --bg-start: #e0e7ff;
  --bg-end: #ede9fe;
  --text-dark: #1e293b;
  --text-light: #64748b;
  --error-color: #ef4444;
  --success-color: #10b981;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  /* align-items: flex-start (not center) + margin:auto on .container below is the
     standard fix for "vertically centered flexbox that still scrolls when content
     is taller than the viewport" — with align-items:center, browsers clip the top
     of overflowing content instead of letting you scroll to it. */
  align-items: flex-start;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  background-attachment: fixed;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  color: var(--text-dark);
}

.background-elements {
  /* 修正：這裡原本是 position:absolute + width/height:100%，因為 body 沒有
     明確的 height（只有 min-height），這個容器實際撐開的高度其實跟著
     「目前畫面內容」變動；再加上裡面的 .blob 用 transform 動畫位移/縮放，
     瀏覽器會把動畫途中裝飾泡泡「視覺上」延伸出去的範圍，一起算進 body 這個
     可捲動容器的 scrollable overflow 裡，導致 body 的 scrollHeight 隨著
     動畫不斷微幅變化——右邊捲軸看起來就像「一直在自己滑動」，並不是真的
     有新內容或使用者在捲動。改成 position:fixed 並釘在視窗尺寸
     （100vw/100vh，不跟著頁面內容高度走），再加上 overflow:hidden 直接
     裁掉任何超出視窗的裝飾效果，兩者都不會再影響任何容器的可捲動範圍。 */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background-color: #a78bfa;
  top: -100px;
  left: -100px;
  animation: float 10s ease-in-out infinite alternate;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background-color: #818cf8;
  bottom: -150px;
  right: -150px;
  animation: float 12s ease-in-out infinite alternate-reverse;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, 50px) scale(1.1); }
}

.lang-switcher {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}

.lang-switcher select {
  width: auto;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  outline: none;
  box-shadow: 0 4px 12px rgba(31, 38, 135, 0.05);
}

.lang-switcher select:hover {
  background: rgba(255, 255, 255, 0.9);
}

.container {
  z-index: 1;
  width: 100%;
  /* 拉到接近整個視窗寬度——批次上傳/框選畫面的照片、縮圖需要更大的
     顯示空間才看得清楚、操作得順手。登入卡片自己有 420px 的 max-width
     （.glass-card），不會因為這裡放寬就跟著變寬。 */
  max-width: 1440px;
  margin: auto 0; /* vertically centers short pages (login), and scrolls naturally from the top on tall ones (dashboard) */
  padding: 20px;
  display: flex;
  justify-content: center;
}

@media (max-width: 600px) {
  .container {
    padding: 10px;
  }
}

.glass-card {
  width: 100%;
  max-width: 420px; /* Auth card default */
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
  transition: transform 0.3s ease;
}

.header {
  text-align: center;
  margin-bottom: 32px;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(to right, #4f46e5, #9333ea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header p {
  color: var(--text-light);
  font-size: 15px;
}

.tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-light);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.tab.active {
  background: white;
  color: var(--text-dark);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-dark);
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 15px;
  transition: all 0.2s;
  outline: none;
}

.input-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: white;
}

.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

/* 按鈕還不能按的時候（例如批次上傳還沒選照片），一定要看起來明顯「還
   不能按」——不然使用者很容易被又大又顯眼的按鈕吸引去按，結果因為還
   沒選照片而完全沒反應，反而覺得「這個按鈕是不是壞了」。實際上該按的
   是旁邊那顆小小的原生「選擇檔案」按鈕。 */
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  margin-top: 24px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

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

/* 檔案選取的原生按鈕（例如「Choose Files」）預設是瀏覽器給的極小方塊，
   跟旁邊又大又顯眼、但選好照片前其實還按不動的「AI 辨識」按鈕比起來，
   很容易讓人搞錯哪一個才是現在真正該按的——放大、換成跟網站一致的主色
   系樣式，讓「先選檔案」這個第一步看起來夠顯眼、夠好按。 */
input[type="file"] {
  font-size: 15px;
  color: var(--text-dark);
}

input[type="file"]::file-selector-button {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  margin-right: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
  background: var(--primary-hover);
}

.btn-google {
  background: white;
  color: var(--text-dark);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-google:hover {
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 24px 0;
  color: var(--text-light);
  font-size: 14px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.divider span {
  padding: 0 10px;
}

.error-message {
  color: var(--error-color);
  font-size: 14px;
  margin-top: 12px;
  padding: 10px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  text-align: center;
}

.success-message {
  color: var(--success-color);
  font-size: 14px;
  margin-top: 12px;
  padding: 10px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 8px;
  text-align: center;
}

.hidden {
  display: none !important;
}

/* --- Dashboard Styles --- */
#dashboard-container {
  max-width: 1440px;
  padding: 32px;
}

@media (max-width: 600px) {
  #dashboard-container {
    padding: 16px;
  }
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-token-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-weight: 700;
  font-size: 15px;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.25);
  display: flex;
  align-items: center;
}

.dashboard-header h1 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(to right, #4f46e5, #9333ea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dashboard-header p {
  color: var(--text-light);
  font-size: 15px;
  margin-top: 4px;
}

.btn-secondary {
  background: rgba(0,0,0,0.05);
  color: var(--text-dark);
  width: auto;
  padding: 8px 16px;
  margin-top: 0;
}

.btn-secondary:hover {
  background: rgba(0,0,0,0.1);
}

/* 新增題目區塊（上傳照片／手動輸入／匯入 Excel-CSV）現在改成單欄、
   佔滿整個頁面寬度——這個區塊本來擠在跟題目列表對半分的窄欄裡，照片
   縮圖、框選畫面都因此被壓得很小，很難看清楚內容、也不好操作。改成
   單欄之後題目列表跟著排到下面，一樣佔滿整個寬度。 */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

.dashboard-grid h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--text-dark);
}

.upload-section {
  background: rgba(255, 255, 255, 0.4);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.questions-section {
  display: flex;
  flex-direction: column;
}

.questions-list {
  /* 原本這裡用固定 500px 的高度 + overflow-y:auto，不管題目有幾題都擠在
     同一個小捲動框裡；改成搭配分頁功能（見 .questions-list-toolbar /
     .questions-pagination）之後，畫面上一次只會渲染使用者選擇的題數
     （預設 10 題），容器本身不需要再限制高度或內部捲動，直接讓外框跟著
     這一頁實際的卡片數量自然撐開即可。 */
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.questions-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 10px 0;
  font-size: 14px;
  color: var(--text-light);
}

.questions-list-toolbar select {
  width: auto;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  color: var(--text-dark);
  cursor: pointer;
}

.questions-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}

.questions-pagination.hidden {
  display: none;
}

.questions-pagination button {
  width: auto;
  padding: 8px 16px;
}

.questions-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.questions-page-info {
  font-size: 14px;
  color: var(--text-light);
  white-space: nowrap;
}

/* --- 圖形題（題幹附圖 / 選項本身是圖形）目前不支援「生成變式題（AI）」，
   用一段提示文字取代按鈕，讓家長知道為什麼看不到那顆按鈕，而不是誤以為
   功能故障。 --- */
.tag-variant-unsupported {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-light);
  background: rgba(100, 116, 139, 0.12);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: help;
}

/* --- 家長手動標記/取消標記「圖形題」的小連結——見 main.js
   isAutoDetectedGraphic() 的說明：AI 辨識不保證每次都準，這個連結讓家長
   可以自己修正，故意做得低調（純文字、無底色），不會搶走主要按鈕的
   視覺重量。 --- */
.graphic-toggle-row {
  margin-top: 4px;
  text-align: right;
}

.btn-link-toggle-graphic {
  width: auto;
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--text-light);
  text-decoration: underline;
  cursor: pointer;
}

.btn-link-toggle-graphic:hover {
  color: var(--primary-color);
}

.btn-link-toggle-graphic:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.question-card {
  background: white;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 我的題目列表的預覽縮圖：固定大小的框，圖片整張縮放進去（contain，不裁切），
   不管原圖是長是寬，每張卡片的縮圖區塊都一樣大、版面整齊。 */
.question-thumb-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 220px;
  padding: 6px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
}

.question-thumb-box img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@media (max-width: 600px) {
  .question-thumb-box {
    height: 180px;
  }
}

.question-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.btn-delete {
  background: transparent;
  color: var(--error-color);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete:hover {
  background: var(--error-color);
  color: white;
  border-color: var(--error-color);
}

.tag-category {
  display: inline-block;
  background: var(--bg-start);
  color: var(--primary-color);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.md-content {
  font-size: 15px;
  color: var(--text-light);
  line-height: 1.5;
  white-space: pre-wrap;
  margin-top: 8px;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  width: 90%;
  max-width: 400px;
  padding: 30px;
  /* AI 設定現在有多個服務商欄位，內容可能比螢幕還高（尤其是手機），
     所以讓這個卡片自己內部捲動，而不是讓 Save/Close 按鈕整個被切掉、
     捲不到（跟之前修過的整頁捲軸問題是同一類原因）。 */
  max-height: 85vh;
  overflow-y: auto;
}

/* --- Quiz Mode --- */
.quiz-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
}

.quiz-header-info {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 760px;
  margin-bottom: 20px;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.quiz-font-controls {
  display: flex;
  gap: 8px;
}

.btn-font-adj {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-dark);
  transition: all 0.2s;
}

.btn-font-adj:hover:not(:disabled) {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

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

.quiz-progress {
  font-size: 16px;
  color: var(--text-dark);
  font-weight: 600;
}

.quiz-timer {
  font-size: 18px;
  color: var(--primary-color);
  font-weight: 700;
  background: white;
  padding: 6px 16px;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.quiz-timer.warning {
  color: #ef4444;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.quiz-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 760px;
  margin-bottom: 24px;
  --quiz-font-size: 20px;
}

.quiz-card img {
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 16px;
  background: #f8fafc;
}

.quiz-card .md-content {
  font-size: var(--quiz-font-size, 20px);
  line-height: 1.6;
}

#quiz-media-container {
  position: relative;
}

.quiz-zoom-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.2s;
}

.quiz-zoom-btn:hover {
  background: #ffffff;
  transform: scale(1.06);
}

.mcq-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
  width: 100%;
}

@media (max-width: 600px) {
  .mcq-container {
    grid-template-columns: 1fr;
  }
}

.btn-mcq {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  padding: 18px 22px;
  border-radius: 14px;
  text-align: left;
  font-size: calc(var(--quiz-font-size, 20px) * 0.85);
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-mcq:hover {
  background: #f8fafc;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.12);
}

.btn-mcq.selected {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.12));
  border-color: var(--primary-color);
  color: var(--primary-color);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.btn-mcq.correct {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.08));
  border-color: #10b981;
  color: #10b981;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}

.btn-mcq.correct .mcq-badge {
  background: #10b981;
  color: #ffffff;
}

.btn-mcq.wrong-selected {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.08));
  border-color: #ef4444;
  color: #ef4444;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}

.btn-mcq.wrong-selected .mcq-badge {
  background: #ef4444;
  color: #ffffff;
}

.mcq-container.locked .btn-mcq {
  cursor: default;
  pointer-events: none;
}

.mcq-container.locked .btn-mcq:not(.correct):not(.wrong-selected) {
  opacity: 0.65;
}

.mcq-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.btn-mcq.selected .mcq-badge {
  background: var(--primary-color);
  color: #ffffff;
}

/* 選項本身是圖形（而不是文字）時，答題按鈕裡顯示截取出來的圖片 */
.mcq-option-image {
  max-width: 100%;
  max-height: 130px;
  object-fit: contain;
}

.answer-option-thumb {
  max-width: 60px;
  max-height: 60px;
  object-fit: contain;
  vertical-align: middle;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
}

.quiz-controls {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 760px;
  justify-content: center;
}

.quiz-controls .btn {
  min-width: 120px;
}

.check-answer-feedback {
  margin-top: 10px;
  font-weight: 600;
  font-size: 15px;
}

/* --- Quiz explanation reveal: shown the instant a question is locked
   (correct or wrong), so the student can learn from it right away. --- */
.quiz-explanation-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  text-align: left;
}

.quiz-explanation-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  color: #4f46e5;
}

.quiz-explanation-text {
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: inherit;
}

.quiz-explanation-box.quiz-explanation-empty {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.3);
}

.quiz-explanation-box.quiz-explanation-empty .quiz-explanation-title {
  color: #64748b;
}

.quiz-explanation-box.quiz-explanation-empty .quiz-explanation-text {
  font-style: italic;
  color: #64748b;
}

/* --- Quiz Image Lightbox (in-page zoom/pan viewer) --- */
.lightbox-overlay {
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
}

.lightbox-box {
  background: #111827;
  border-radius: 16px;
  width: 92vw;
  max-width: 900px;
  height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.lightbox-zoom-level {
  color: #e5e7eb;
  font-size: 13px;
  min-width: 44px;
  text-align: center;
}

.btn-lightbox-tool {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #f9fafb;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-lightbox-tool:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-close {
  margin-left: 6px;
}

.lightbox-viewport {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}

.lightbox-viewport.dragging {
  cursor: grabbing;
}

#lightbox-img {
  max-width: 100%;
  max-height: 100%;
  transition: transform 0.05s linear;
  user-select: none;
  pointer-events: none;
}

/* --- Results Mode --- */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.result-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.result-card img {
  width: 100%;
  max-width: 300px;
  border-radius: 8px;
  align-self: center;
}

.result-answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 15px;
}

.result-answers .label {
  font-weight: 600;
  color: var(--text-dark);
}

.text-correct {
  color: #10b981;
  font-weight: 600;
}

.text-wrong {
  color: #ef4444;
  font-weight: 600;
}

select, textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 15px;
  transition: all 0.2s;
  outline: none;
  font-family: 'Inter', sans-serif;
  resize: vertical;
}

select:focus, textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: white;
}

/* --- HTML File Preview Component --- */
.html-preview-card {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: #1e1e2e;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  margin-bottom: 8px;
}

.browser-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.browser-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.browser-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.browser-address-bar {
  font-size: 12px;
  color: #a6adc8;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-open-html {
  color: #89b4fa;
  font-size: 13px;
  text-decoration: none;
  background: rgba(137, 180, 250, 0.15);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-open-html:hover {
  background: rgba(137, 180, 250, 0.3);
  color: #ffffff;
}

.web-snapshot-container {
  width: 100%;
  height: 240px;
  position: relative;
  background: #ffffff;
}

.question-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* --- Reward Tokens Card --- */
.token-reward-card {
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.08);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.token-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.token-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.token-icon {
  font-size: 32px;
  animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.token-title-group h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}

.token-title-group p {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
}

.token-count-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-weight: 800;
  font-size: 18px;
  padding: 8px 18px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  letter-spacing: 0.5px;
}

.token-actions {
  display: flex;
  gap: 10px;
}

.btn-use-token {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
}

.btn-use-token:hover:not(:disabled) {
  background: var(--error-color);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-use-token:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #cbd5e1;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.05);
}

.token-earned-banner {
  margin-top: 15px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(16, 185, 129, 0.15));
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #d97706;
  font-weight: 700;
  font-size: 15px;
  padding: 12px;
  border-radius: 12px;
  text-align: center;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
}

.author-tag {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.5px;
  padding: 4px 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 20px;
  transition: all 0.3s ease;
}

.author-tag:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-color);
}

/* Question Type Toggle Switcher */
.q-type-toggle {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.05);
  padding: 4px;
  border-radius: 12px;
  margin-top: 6px;
}

.q-type-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.q-type-btn.active {
  background: white;
  color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.q-type-toggle-small {
  padding: 3px;
}

.q-type-toggle-small .q-type-btn {
  padding: 6px 8px;
  font-size: 13px;
}

.add-question-title {
  margin-bottom: 10px;
}

/* --- 新增題目：三種模式的分頁切換（上傳照片／手動輸入／匯入 Excel-CSV），
   每次只顯示一種操作方式，樣式沿用既有的 q-type-toggle 分段按鈕風格。 --- */
.add-mode-tabs {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.05);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 18px;
}

.add-mode-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-mode-tab.active {
  background: white;
  color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.add-mode-panel.hidden {
  display: none;
}

/* --- 批次辨識中：只顯示進度＋中斷按鈕，隱藏上傳/框選相關按鈕 --- */
.batch-recognize-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  text-align: center;
}

.batch-recognize-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: batch-recognize-spin 0.8s linear infinite;
}

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

.batch-recognize-progress #batch-recognize-abort-btn {
  width: auto;
}

/* --- 批次辨識/複驗的細部進度：目前辨識到第幾張照片、已辨識/已複驗的
   題數，以及一條隨進度前進的進度條，讓使用者在等待時知道系統還在動、
   而不是卡住了。 --- */
.batch-recognize-detail {
  font-size: 13px;
  color: var(--text-light);
}

.batch-recognize-bar-track {
  width: 100%;
  max-width: 320px;
  height: 8px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.batch-recognize-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary-color);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* --- Excel/CSV 題庫匯入 --- */
.import-card {
  background: rgba(99, 102, 241, 0.06);
  border: 1px dashed rgba(99, 102, 241, 0.35);
  border-radius: 14px;
  padding: 18px;
}

.import-card input[type="file"] {
  display: block;
  margin: 10px 0;
}

.import-summary {
  font-weight: 600;
  margin: 12px 0 8px;
}

.import-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.import-preview-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.import-preview-row.import-preview-row-error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.05);
}

.import-preview-row-index {
  font-weight: 700;
  color: var(--text-light);
  min-width: 28px;
}

.import-preview-row-body {
  flex: 1;
  min-width: 0;
}

.import-preview-row-stem {
  font-weight: 600;
  margin-bottom: 4px;
  overflow-wrap: break-word;
}

.import-preview-row-meta {
  color: var(--text-light);
  font-size: 13px;
}

.import-preview-row-error-msg {
  color: var(--error-color);
  font-size: 13px;
  margin-top: 4px;
  font-weight: 600;
}

/* --- Batch Scan & Upload --- */
.batch-upload-card {
  background: rgba(99, 102, 241, 0.06);
  border: 1px dashed rgba(99, 102, 241, 0.35);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 20px;
}

.batch-upload-card h2 {
  margin-bottom: 6px;
}

.batch-upload-card input[type="file"] {
  margin-top: 10px;
}

.batch-image-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.batch-thumb-small {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

#batch-recognize-btn {
  margin-top: 12px;
  width: 100%;
}

/* --- 手動框選題目範圍（取代讓 AI 自己猜一張照片裡有幾題、每題在哪）--- */
.batch-annotate-section {
  margin: 14px 0;
}

.batch-annotate-photo {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.6);
}

.batch-annotate-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  font-size: 13px;
}

.batch-annotate-filename {
  font-weight: 700;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.batch-annotate-count {
  color: var(--primary-color);
  font-weight: 700;
  white-space: nowrap;
}

.batch-annotate-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.batch-annotate-zoom-controls button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: white;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.batch-annotate-zoom-pct {
  min-width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-light, #6b7280);
}

.batch-annotate-zoom-reset,
.batch-annotate-clear-btn {
  border: none;
  background: none;
  color: var(--primary-color);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  white-space: nowrap;
}

.batch-annotate-hint {
  font-size: 13px;
  color: var(--text-light, #6b7280);
  margin: 0 0 8px;
}

.batch-annotate-viewport {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(45deg, #f4f4f5 25%, transparent 25%, transparent 75%, #f4f4f5 75%),
    linear-gradient(45deg, #f4f4f5 25%, #ffffff 25%, #ffffff 75%, #f4f4f5 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}

.batch-annotate-stage {
  position: relative;
  display: block;
}

.batch-annotate-img {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.batch-annotate-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
}

.batch-annotate-box {
  position: absolute;
  border: 2px solid #6366f1;
  background: rgba(99, 102, 241, 0.15);
  box-sizing: border-box;
}

.batch-annotate-box-drawing {
  border-style: dashed;
  background: rgba(99, 102, 241, 0.08);
}

.batch-annotate-box-label {
  position: absolute;
  top: -2px;
  left: -2px;
  background: #6366f1;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 0 0 6px 0;
  pointer-events: none;
}

.batch-annotate-box-remove {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: white;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}

.batch-annotate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.batch-annotate-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(99, 102, 241, 0.1);
  color: #4338ca;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 600;
}

.batch-annotate-chip-remove {
  border: none;
  background: none;
  color: #4338ca;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  line-height: 1;
}

.batch-review-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.batch-draft-card {
  display: flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 14px;
  transition: opacity 0.2s;
}

/* 未勾選「加入這一題」的卡片以前是整張卡片淡化 45%（opacity 會連同子
   元素一起合成，就算子元素自己設 opacity:1 也救不回來），結果連原圖
   縮圖、截圖也一起變得很難看清楚，勾選框本身也因為整張卡片變淡而看
   起來像被鎖住、不能點。使用者要看清楚縮圖才能決定這一題原題到底是
   什麼、要不要收錄，所以這裡改成只淡化「文字型欄位」（分類、題型、
   題幹、文字選項、正確解答、警示文字），縮圖（來源照片、題幹圖表、
   選項圖形）跟頂部的勾選框/badge/刪除鈕都維持原本清晰度、不淡化。 */
.batch-draft-card.batch-draft-excluded .batch-draft-fields > .input-group,
.batch-draft-card.batch-draft-excluded .batch-draft-opt,
.batch-draft-card.batch-draft-excluded .batch-draft-verify-note {
  opacity: 0.55;
}

.batch-draft-thumb {
  flex-shrink: 0;
  width: 168px;
}

.batch-draft-thumb img {
  width: 168px;
  height: 168px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: zoom-in;
  transition: transform 0.15s ease;
}

/* 手機直向：草稿卡改成縮圖在上、欄位在下的單欄排列，縮圖佔滿卡片寬度，
   避免窄螢幕上縮圖被擠成一小塊、文字欄位又被壓得太窄。 */
@media (max-width: 640px) {
  .batch-draft-card {
    flex-direction: column;
  }
  .batch-draft-thumb {
    width: 100%;
  }
  .batch-draft-thumb img {
    width: 100%;
    height: auto;
    max-height: 280px;
  }
}

.batch-draft-thumb img:hover {
  transform: scale(1.03);
}

.batch-draft-fields {
  flex: 1;
  min-width: 0;
}

.batch-draft-fields .input-group {
  margin-bottom: 10px;
}

.batch-draft-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.batch-draft-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
}

.batch-draft-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

/* 選項內容有時候比較長（例如「Left: Blue, Right: Red」這種說明型選項）。
   之前這裡是單行 <input>，但站內大部分表單控制項的寬度都是靠一條全域的
   `select, textarea { width: 100%; }` 規則撐滿容器，唯獨 <input> 沒有被
   涵蓋到——所以這 4 個選項框其實一直是瀏覽器給的預設固定寬度（跟格子的
   實際寬度無關），格子比較窄的時候，內容比較長就會整個看起來超出格子
   外面。改成 <textarea> 之後這裡明確補上 width: 100%，並且讓高度可以
   隨內容自動增高（JS 見 autoGrowTextarea()），文字太長時改成自然換行，
   不會再被撐出格子。 */
.batch-draft-options-grid textarea.batch-draft-opt {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.45;
  min-height: 38px;
  max-height: 160px;
  overflow-y: auto;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
}

.batch-draft-answer-group select,
.batch-draft-answer-group input {
  margin-top: 4px;
}

.batch-submit-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.batch-submit-row .btn {
  flex: 1;
}

/* --- 圖表截圖 + 向量化 + AI 複驗 ---
   截圖縮圖故意放大（而不是先前的 48px 小圖示），讓家長送出前能清楚看到
   AI 實際截下來、準備存進題庫的圖表長什麼樣子；點縮圖可在新分頁看原尺寸。 */
.diagram-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light, #6b7280);
}

.diagram-preview-thumb {
  width: 110px;
  height: 110px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  cursor: zoom-in;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.diagram-preview-thumb:hover {
  transform: scale(1.03);
}

.verify-override-row {
  margin: 10px 0;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  font-size: 14px;
}

.verify-override-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* 2026-09-30 新增：「換 model 重新辨識」下拉選單（手動輸入表單、複驗沒過時顯示） */
.retry-recognize-row {
  margin: 10px 0;
  padding: 10px 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.retry-recognize-row label {
  font-weight: 600;
  color: var(--text-light, #6b7280);
}

.retry-recognize-row select {
  flex: 1 1 auto;
  min-width: 160px;
}

/* 批次審核卡片上的同一個功能，樣式跟卡片本身的複驗提示區塊呼應 */
.batch-draft-retry-row {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.batch-draft-retry-row select {
  flex: 1 1 auto;
  min-width: 140px;
  font-size: 13px;
}

.batch-draft-retry-status {
  flex-basis: 100%;
  margin-top: 0;
}

.verify-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.verify-badge.verify-pass {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.verify-badge.verify-fail {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
}

.verify-badge.verify-error {
  background: rgba(234, 179, 8, 0.15);
  color: #a16207;
}

.verify-badge.verify-running {
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
}

.batch-draft-card.batch-draft-needs-review {
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.04);
}

.batch-draft-diagram-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.batch-draft-diagram-thumb {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  cursor: zoom-in;
  transition: transform 0.15s ease;
}

.batch-draft-diagram-thumb:hover {
  transform: scale(1.03);
}

.batch-draft-verify-note {
  font-size: 13px;
  color: var(--text-light, #6b7280);
  margin-top: 2px;
}

.batch-draft-opt-cell {
  min-width: 0;
}

/* 圖形選項截圖失敗時（AI 判斷是圖形，但沒能成功截出圖片），文字框保留
   可編輯，並用醒目的警示樣式取代「空白到看不出內容」的預設外觀，提醒
   家長要點左側放大後的原圖確認內容、自己手動打字填入。 */
.option-crop-failed {
  border-color: rgba(234, 179, 8, 0.6) !important;
  background: rgba(234, 179, 8, 0.08) !important;
  color: #92400e !important;
}

.option-crop-failed::placeholder {
  color: #a16207;
  opacity: 1;
}

/* --- 選項本身是圖形時的縮圖列（手動表單 + 批次草稿卡片共用同一種樣式） ---
   縮圖同樣放大，讓每個選項截出來的圖形清楚可辨，並可點擊放大確認。 */
.option-image-row,
.batch-draft-opt-image-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 6px;
  padding: 6px 8px;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-light, #6b7280);
}

.option-image-thumb,
.batch-draft-opt-image-thumb {
  width: 76px;
  height: 76px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  cursor: zoom-in;
  transition: transform 0.15s ease;
}

.option-image-thumb:hover,
.batch-draft-opt-image-thumb:hover {
  transform: scale(1.04);
}

.btn-gen-variant {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-gen-variant:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tag-variant {
  background: rgba(139, 92, 246, 0.15);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

/* =====================================================================
   MyQuizBank v2 additions — Parent/Student roles, Ebbinghaus review,
   gamification (level/XP/unlock), AI settings (BYOK)
   ===================================================================== */

.tag-due {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}

.tag-mastery {
  font-size: 13px;
  color: #d97706;
  letter-spacing: 1px;
}

/* --- Top-right bar (settings + language) --- */
.top-right-bar {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switcher {
  position: static;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(31, 38, 135, 0.05);
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: rotate(20deg);
}

/* --- Student switcher --- */
.student-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.student-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-icon {
  font-size: 18px;
}

#student-select {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  background: white;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
}

.student-bar-actions {
  display: flex;
  gap: 8px;
}

.btn-chip {
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary-color);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-chip:hover {
  background: rgba(99, 102, 241, 0.18);
}

.btn-chip-danger {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: var(--error-color);
  padding: 7px 10px;
}

.btn-chip-danger:hover {
  background: rgba(239, 68, 68, 0.18);
}

.input-group-inline {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.input-group-inline input {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  background: white;
  font-size: 15px;
}

.btn-inline {
  width: auto;
  margin-top: 0;
  padding: 10px 16px;
}

/* --- Progression card (Level / XP) --- */
.progression-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.progression-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--text-dark);
}

.level-badge {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.xp-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.feature-chip {
  font-size: 13px;
  font-weight: 600;
  color: #4f46e5;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 3px 10px;
  border-radius: 12px;
}

/* --- Daily review card --- */
.daily-review-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.daily-review-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.daily-review-card #start-daily-review-btn {
  width: auto;
  margin-top: 0;
  padding: 10px 20px;
}

.daily-review-card #start-daily-review-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Mastery stats (simple bars, no chart library needed) --- */
.mastery-stats-card {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 8px;
}

.mastery-stats-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-dark);
}

.mastery-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.mastery-row-label {
  width: 70px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  flex-shrink: 0;
}

.mastery-row-track {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  overflow: hidden;
}

.mastery-row-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 8px;
}

.mastery-row-pct {
  font-size: 13px;
  font-weight: 700;
  color: #10b981;
  width: 34px;
  text-align: right;
}

/* --- Upload form: instant image thumbnail preview ---
   放大原始照片預覽的上限高度，讓家長送出前能清楚看到準備上傳的原圖，
   並可點擊在新分頁放大檢視。 */
.image-preview {
  display: block;
  margin-top: 10px;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
  object-fit: contain;
  background: rgba(0, 0, 0, 0.03);
  cursor: zoom-in;
  transition: transform 0.15s ease;
}

.image-preview:hover {
  transform: scale(1.01);
}

/* --- AI assist button + status text --- */
.btn-ai-assist {
  margin-top: 8px;
  width: 100%;
  padding: 9px;
  border: 1px dashed rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.06);
  color: var(--primary-color);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ai-assist:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.14);
}

.btn-ai-assist:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* --- Debug log panel (under AI status text): raw attempt-by-attempt trace --- */
.ai-debug-log {
  margin-top: 6px;
  max-height: 160px;
  overflow-y: auto;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.92);
  color: #a5f3fc;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- AI Settings modal: multi-provider key rows --- */
.ai-provider-row {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.ai-provider-row:first-child {
  border-top: none;
  padding-top: 0;
}

.ai-provider-row-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.ai-provider-key-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
}

.ai-provider-key-link:hover {
  text-decoration: underline;
}

.ai-provider-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-provider-input-row input {
  flex: 1;
}

.ai-provider-clear-btn {
  flex-shrink: 0;
  width: 36px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: var(--error-color);
  cursor: pointer;
  font-size: 15px;
}

.ai-provider-clear-btn:hover {
  background: rgba(239, 68, 68, 0.16);
}

.ai-cors-caveat {
  margin-top: 4px;
  font-size: 13px;
  color: #b45309;
}

.ai-status-text {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  line-height: 1.5;
}

.ai-status-text.success {
  color: var(--success-color);
}

.ai-status-text.error {
  color: var(--error-color);
}

.ai-settings-desc {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
}

.ai-key-hint {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 6px;
}

/* 新增題目三個分頁上方的操作說明段落——這段文字使用者一定要先看懂才
   知道怎麼操作（例如「框選是可選的」「不框也能直接送出」），不是隨手
   帶過的小提示，字體跟對比度都要比一般 hint 明顯許多，不能沿用給
   「API Key 小提示」用的 11px 極小字。 */
.panel-desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-dark);
  opacity: 0.75;
  margin-bottom: 14px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}

/* --- Level Up celebration modal (pure CSS, no external deps) --- */
.level-up-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  background: linear-gradient(180deg, #0f172a, #1e1b4b, #0f172a);
  border: 2px solid rgba(251, 191, 36, 0.8);
  border-radius: 20px;
  box-shadow: 0 0 60px rgba(251, 191, 36, 0.25);
  text-align: center;
  color: white;
  animation: levelUpPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes levelUpPop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.level-up-glow {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  background: rgba(251, 191, 36, 0.25);
  border-radius: 50%;
  filter: blur(24px);
  animation: pulse 2s infinite;
}

.level-up-badge {
  color: #fbbf24;
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 13px;
  text-transform: uppercase;
  margin-bottom: 8px;
  position: relative;
}

.level-up-trophy {
  font-size: 48px;
  margin-bottom: 12px;
  position: relative;
  animation: bounce 1.5s infinite ease-in-out;
}

.level-up-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 10px;
  position: relative;
}

.level-up-desc {
  font-size: 15px;
  color: #cbd5e1;
  margin-bottom: 16px;
  position: relative;
  line-height: 1.6;
}

.level-up-features {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 20px;
  position: relative;
}

.unlocked-feature-row {
  font-size: 14px;
  font-weight: 600;
  color: #fde68a;
  padding: 4px 0;
}

.level-up-card #level-up-close-btn {
  position: relative;
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

@media (max-width: 600px) {
  .top-right-bar {
    top: 12px;
    right: 12px;
  }
  .student-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .daily-review-card {
    flex-direction: column;
    align-items: stretch;
  }
  .daily-review-card #start-daily-review-btn {
    width: 100%;
  }
}

/* 2026-10-05：解答（選填）區塊、題幹圖去除選項的預覽 */
.solution-group { padding: 10px 12px; border: 1px dashed var(--border-color, #d1d5db); border-radius: 10px; }
.solution-ai-toggle { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 0; cursor: pointer; }
.solution-group textarea { margin-top: 6px; }
.stem-masked-row .diagram-preview-thumb { max-width: 220px; }
.batch-solution-block { margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--border-color, #d1d5db); border-radius: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.batch-solution-title { font-weight: 600; }
.batch-solution-ai { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.batch-draft-masked-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-light, #6b7280); }
.batch-draft-masked-thumb { max-width: 140px; max-height: 100px; border: 1px solid var(--border-color, #d1d5db); border-radius: 6px; }

/* Round G 後續：框選項模式 */
.batch-annotate-mode { display: inline-flex; border: 1px solid #c7d2fe; border-radius: 8px; overflow: hidden; }
.batch-annotate-mode-btn { border: none; background: #fff; color: #4338ca; padding: 4px 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.batch-annotate-mode-btn.active { background: #6366f1; color: #fff; }
.batch-annotate-mode-btn[data-mode="options"].active { background: #f59e0b; }
.batch-annotate-box-options { border-color: #f59e0b; background: rgba(245, 158, 11, 0.18); border-style: dashed; }
.batch-annotate-box-options .batch-annotate-box-label { background: #f59e0b; top: auto; bottom: -2px; left: -2px; border-radius: 0 6px 0 0; }
.batch-annotate-box-drawing-options { border-color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.batch-annotate-chip-options { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.batch-annotate-chip-options .batch-annotate-chip-remove { color: #b45309; }
.batch-annotate-mode-warn { color: #b45309; font-size: 13px; margin: 4px 0; }
.batch-draft-not-separated-row { font-size: 13px; color: #b45309; background: rgba(245, 158, 11, 0.12); border-radius: 6px; padding: 4px 8px; }

/* =====================================================================
   個人化類別（科目 → 單元）＋ 掌握度雷達圖（2026-10-11）
   ===================================================================== */
.mastery-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.mastery-controls label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
}

.mastery-controls select {
  width: auto;
  min-width: 140px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 10px;
}

.mastery-view-toggle {
  display: inline-flex;
  margin-left: auto;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 10px;
  overflow: hidden;
}

.mastery-view-btn {
  width: auto;
  background: rgba(255, 255, 255, 0.6);
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
}

.mastery-view-btn + .mastery-view-btn {
  border-left: 1px solid rgba(99, 102, 241, 0.35);
}

.mastery-view-btn.active {
  background: var(--primary-color);
  color: white;
}

.mastery-stats-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-light);
}

.mastery-radar {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
}

.mastery-radar .radar-ring {
  fill: none;
  stroke: rgba(251, 191, 146, 0.55);
  stroke-width: 1;
}

.mastery-radar .radar-ring:last-of-type {
  stroke: rgba(249, 115, 22, 0.35);
}

.mastery-radar .radar-spoke {
  stroke: rgba(251, 191, 146, 0.55);
  stroke-width: 1;
}

.mastery-radar .radar-ring-label {
  font-size: 9px;
  fill: var(--text-light);
}

/* 橘色戰力圖：淡色六邊形底、橘色面積與圓點、粗體軸名稱 */
.mastery-radar .radar-area {
  fill: rgba(249, 115, 22, 0.30);
  stroke: #f97316;
  stroke-width: 2;
  stroke-linejoin: round;
}

.mastery-radar .radar-dot {
  fill: #f97316;
  stroke: white;
  stroke-width: 1.5;
}

.mastery-radar .radar-axis-label {
  font-size: 13px;
  font-weight: 700;
  fill: var(--text-dark);
}

.mastery-radar .radar-axis-empty {
  fill: var(--text-light);
  font-weight: 600;
}

.mastery-radar.radar-compact {
  max-width: 260px;
}

.mastery-radar.radar-compact .radar-axis-label {
  font-size: 11px;
}

.mastery-radar.radar-compact .radar-area {
  stroke-width: 1.5;
}

.skill-radar-title,
.sa-skill-detail-title {
  margin: 4px 0 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
}

.skill-apply-row {
  display: flex;
  justify-content: center;
  margin: 8px 0 2px;
}

/* 學習狀態分析：四科並排的小六芒星 */
.sa-skill-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

@media (max-width: 760px) {
  .sa-skill-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sa-skill-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px 6px;
  border: 1px solid rgba(251, 191, 146, 0.6);
  border-radius: 12px;
  background: rgba(255, 247, 237, 0.6);
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.sa-skill-card:hover {
  border-color: #f97316;
}

.sa-skill-card.active {
  border-color: #f97316;
  background: rgba(255, 237, 213, 0.9);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.25);
}

.sa-skill-card-name {
  font-weight: 700;
  font-size: 14px;
}

.sa-skill-card-sub {
  font-size: 11px;
  color: var(--text-light);
}

.sa-rank-empty .sa-rank-name {
  color: var(--text-light);
}

.cm-tpl-desc {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-light);
}

.cm-tpl-btn {
  border-color: #f97316;
  color: #c2410c;
}

.cm-tpl-done {
  color: #15803d;
}

/* 我的題目：全選本頁、類別管理 */
.questions-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
}

.q-select {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary-color);
}

/* 批次移動列 */
.batch-move-bar {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 10px 14px;
  background: rgba(238, 242, 255, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.15);
}

.batch-move-bar.hidden {
  display: none;
}

.batch-move-bar #batch-move-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-color);
}

.batch-move-bar select {
  width: auto;
  min-width: 120px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 10px;
}

.batch-move-bar .btn {
  width: auto;
  padding: 6px 14px;
  font-size: 13px;
}

/* 題目卡片上的行內類別編輯器 */
.category-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  margin: 8px 0;
  padding: 10px 12px;
  background: rgba(238, 242, 255, 0.7);
  border: 1px dashed rgba(99, 102, 241, 0.5);
  border-radius: 12px;
}

.category-editor label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}

.category-editor select {
  width: auto;
  min-width: 130px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 10px;
}

.category-editor .btn {
  width: auto;
  padding: 6px 14px;
  font-size: 13px;
}

/* 類別管理視窗 */
.modal-content.category-manager-content {
  max-width: 640px;
  padding: 24px;
}

.cm-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.cm-subject {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
}

.cm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 4px 0;
}

.cm-subject-row {
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.cm-unit {
  margin-left: 18px;
}

.cm-name {
  flex: 1 1 120px;
  min-width: 0;
  font-size: 14px;
  color: var(--text-dark);
  overflow-wrap: anywhere;
}

.cm-count {
  font-size: 12px;
  color: var(--text-light);
}

.cm-tag {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-color);
}

.cm-btn {
  width: auto;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  background: white;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 8px;
  cursor: pointer;
}

.cm-btn:hover {
  background: rgba(99, 102, 241, 0.08);
}

.cm-btn.cm-danger {
  color: var(--error-color);
  border-color: rgba(239, 68, 68, 0.45);
}

.cm-btn.cm-danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

.cm-btn.cm-add {
  margin: 6px 0 0 18px;
  border-style: dashed;
}

.cm-subject + .cm-add,
#category-manager-body > .cm-add {
  margin-left: 0;
}

.cm-empty {
  margin: 2px 0 0 18px;
  font-size: 12px;
  color: var(--text-light);
}

.cm-merge-picker {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 8px;
  font-size: 12px;
  background: rgba(238, 242, 255, 0.8);
  border-radius: 8px;
}

.cm-merge-picker select {
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 8px;
}

/* =====================================================================
   來源（考卷）與標籤：挑選器、篩選列、卡片標籤、管理視窗新區塊（2026-10-12）
   ===================================================================== */
.label-extras {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}

.label-extras:empty {
  display: none;
}

.le-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}

.le-field select {
  width: auto;
  min-width: 140px;
  max-width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 10px;
}

.le-tags {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.le-tags-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}

.le-tag-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.le-chip {
  width: auto;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(100, 116, 139, 0.35);
  border-radius: 999px;
  cursor: pointer;
}

.le-chip:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.le-chip.on {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.le-chip-new {
  border-style: dashed;
  color: var(--primary-color);
  border-color: rgba(99, 102, 241, 0.5);
}

.label-defaults-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 12px 14px;
  background: rgba(238, 242, 255, 0.6);
  border: 1px dashed rgba(99, 102, 241, 0.45);
  border-radius: 12px;
}

.label-defaults-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.label-defaults-card > .le-field select {
  min-width: 200px;
}

.batch-draft-label-extras {
  margin: 0 0 10px;
}

/* 題目卡片上的來源／標籤 */
.tag-source,
.tag-user {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
}

.tag-source {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.tag-user {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

/* 「我的題目」篩選列 */
.questions-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.questions-filter-bar select {
  width: auto;
  min-width: 120px;
  max-width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 10px;
}

.questions-filter-bar select.hidden,
.scope-select.hidden {
  display: none;
}

.filter-count {
  font-size: 12px;
  color: var(--text-light);
}

.questions-filter-bar .btn {
  width: auto;
  padding: 4px 12px;
  font-size: 12px;
}

.scope-select {
  width: auto;
  max-width: 100%;
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 10px;
}

/* 管理視窗：來源／標籤區塊 */
.cm-section-title {
  margin: 14px 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
}

.cm-sources .cm-row,
.cm-tags .cm-row {
  margin-left: 0;
}

.cm-sources .cm-add,
.cm-tags .cm-add {
  margin-left: 0;
}

.label-extras .le-field,
.label-defaults-card .le-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.label-extras .le-field > span,
.label-defaults-card .le-field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}

#manual-label-extras {
  margin-top: -4px;
}

/* =====================================================================
   學習狀態分析（點「知識點掌握度統計」圖示）（2026-10-13）
   ===================================================================== */
.feature-chip-btn {
  cursor: pointer;
  font-family: inherit;
  width: auto;
  transition: background 0.15s, box-shadow 0.15s;
}

.feature-chip-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.modal-content.status-analysis-content {
  max-width: 760px;
  padding: 24px;
}

.sa-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 8px 0 14px;
}

.sa-kpi {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
}

.sa-kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1.1;
}

.sa-kpi-sub {
  font-size: 12px;
  color: var(--text-light);
}

.sa-kpi-label {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}

.sa-section {
  margin: 14px 0;
}

.sa-section h3 {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
}

.sa-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-light);
}

.sa-dist-bar {
  display: flex;
  height: 16px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
}

.sa-dist-seg {
  height: 100%;
}

.sa-dist-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-light);
}

.sa-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-radius: 50%;
}

.sa-lvl-0 { background: #cbd5e1; }
.sa-lvl-1 { background: #fca5a5; }
.sa-lvl-2 { background: #fdba74; }
.sa-lvl-3 { background: #fde68a; }
.sa-lvl-4 { background: #86efac; }
.sa-lvl-5 { background: #34d399; }

.sa-rank-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sa-rank-name {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  overflow-wrap: anywhere;
}

.sa-rank-track {
  flex: 1 1 120px;
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
}

.sa-rank-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, #f87171, #fbbf24);
}

.sa-rank-fill.strong {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.sa-rank-pct {
  width: 40px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
}

.sa-rank-count {
  font-size: 12px;
  color: var(--text-light);
}

.sa-practice-btn {
  width: auto;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  background: white;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 8px;
  cursor: pointer;
}

.sa-practice-btn:hover {
  background: rgba(99, 102, 241, 0.08);
}

.sa-insights {
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-dark);
}

.sa-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 14px;
}

.sa-action-row .btn {
  width: auto;
}

/* ===== 題目列表卡片：只顯示文字題幹，底下一排可點擊的分類小標籤 ===== */
.question-card-header {
  gap: 8px;
  flex-wrap: wrap;
}

.q-header-left,
.q-header-right {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.q-stem {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-dark);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.q-stem-empty {
  color: var(--text-light);
  font-style: italic;
}

.q-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.q-chip {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--primary-color);
  background: var(--bg-start);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}

.q-chip:hover,
.q-chip.open {
  border-color: var(--primary-color);
}

.q-chip-empty {
  color: var(--text-light);
  background: transparent;
  border: 1px dashed rgba(100, 116, 139, 0.45);
  font-weight: 500;
}

.q-chip-skills:not(.q-chip-empty) {
  background: rgba(249, 115, 22, 0.14);
  color: #c2410c;
}

.q-chip-tag:not(.q-chip-empty) {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.q-chip-caret {
  font-size: 10px;
  opacity: 0.7;
}

.q-popover {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
}

.q-pop-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
}

.q-pop-select {
  width: auto;
  min-width: 160px;
  max-width: 100%;
  padding: 4px 8px;
  font-size: 13px;
}

.q-pop-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.q-pop-close {
  width: auto;
  margin-left: auto;
  padding: 0 6px;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
}

.q-image-link {
  margin-left: 10px;
  font-size: 12px;
  color: var(--text-light);
}

/* 各科統計未解鎖 */
.subject-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  text-align: center;
  color: var(--text-light);
}

.subject-lock-icon {
  font-size: 32px;
}

.subject-lock-msg {
  margin: 0;
  font-size: 14px;
}

.subject-lock-track {
  width: min(280px, 100%);
  height: 8px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.2);
  overflow: hidden;
}

.subject-lock-fill {
  height: 100%;
  background: linear-gradient(90deg, #fdba74, #f97316);
}

.sa-skill-card-lock {
  font-size: 34px;
  line-height: 120px;
  opacity: 0.7;
}

/* 原圖：在卡片內完整展開 */
.q-image-panel {
  margin-top: 10px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid rgba(100, 116, 139, 0.25);
  border-radius: 10px;
  text-align: center;
}

.q-image-panel img {
  max-width: 100%;
  max-height: 240px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  cursor: zoom-in;
}

.q-image-hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-light);
}

@media (max-width: 600px) {
  .q-image-panel img {
    max-height: 180px;
  }
}

.q-image-panel .html-preview-card {
  text-align: left;
}

button.q-image-link {
  width: auto;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

/* 標籤 chip 旁邊的 × */
.q-tag-group {
  display: inline-flex;
  align-items: stretch;
}

.q-tag-group .q-chip {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.q-tag-remove {
  width: auto;
  padding: 0 8px;
  font-size: 14px;
  line-height: 1;
  color: #047857;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid transparent;
  border-left: 1px solid rgba(4, 120, 87, 0.2);
  border-radius: 0 999px 999px 0;
  cursor: pointer;
}

.q-tag-remove:hover {
  background: var(--error-color);
  color: white;
}

.q-pop-delmode {
  width: auto;
  padding: 2px 8px;
  font-size: 12px;
  background: none;
  border: none;
  color: var(--text-light);
  text-decoration: underline;
  cursor: pointer;
}

.q-pop-delmode.on {
  color: var(--primary-color);
  font-weight: 700;
}

.q-popover-del {
  border-color: rgba(239, 68, 68, 0.4);
}

.q-pop-chip-del {
  color: var(--error-color);
  border-color: rgba(239, 68, 68, 0.4);
}

.q-pop-chip-del:hover {
  background: var(--error-color);
  color: white;
  border-color: var(--error-color);
}

/* 挑選列的標籤：右邊的 × 刪除 */
.le-chip-group {
  display: inline-flex;
  align-items: stretch;
}

.le-chip-group .le-chip {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.le-chip-x {
  width: auto;
  padding: 0 8px;
  font-size: 14px;
  line-height: 1;
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(100, 116, 139, 0.35);
  border-left: none;
  border-radius: 0 999px 999px 0;
  cursor: pointer;
}

.le-chip-x.on {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.le-chip-x:hover {
  background: var(--error-color);
  border-color: var(--error-color);
  color: white;
}

/* ===================================================================
   Round H6：設定中心（學習設定／等級與功能／測試／Admin）＋角色徽章
   =================================================================== */
.role-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: #0ea5e9;
}
.role-badge[data-role="admin"] { background: #dc2626; }
.role-badge.hidden { display: none; }

.modal-content.settings-center-content {
  width: min(860px, 94vw);
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
}
.sc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sc-head h2 { margin: 0; }
.sc-head .role-badge { margin-top: 0; }
.sc-tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid rgba(100, 116, 139, 0.25); margin-bottom: 14px; }
.sc-tab {
  border: none; background: transparent; cursor: pointer;
  padding: 8px 14px; font: inherit; font-weight: 600; color: var(--text-light);
  border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0;
}
.sc-tab:hover { color: var(--primary-color); }
.sc-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.sc-body { min-height: 180px; }
.sc-h { margin: 16px 0 6px; font-size: 1rem; color: var(--text-dark); }
.sc-subject-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 8px 0 4px; }
.sc-subject-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer;
  border: 1px solid rgba(100, 116, 139, 0.3); border-radius: 10px; background: rgba(255, 255, 255, 0.6);
}
.sc-subject-item input { width: 18px; height: 18px; accent-color: var(--primary-color); flex: none; }
.sc-subject-name { flex: 1; font-weight: 600; color: var(--text-dark); }
.sc-subject-name em { font-style: normal; font-size: 0.72rem; color: var(--text-light); margin-left: 4px; }
.sc-subject-count { font-size: 0.78rem; color: var(--text-light); }
.sc-daily-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.sc-daily-row input[type="number"] { width: 110px; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(100, 116, 139, 0.4); font: inherit; }
.sc-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.sc-msg { margin: 10px 0; padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; }
.sc-msg-ok { background: rgba(16, 185, 129, 0.14); color: #047857; }
.sc-msg-err { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.sc-level-card { padding: 14px 16px; border-radius: 12px; background: rgba(99, 102, 241, 0.08); }
.sc-level-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; font-weight: 600; }
.sc-solved { margin-left: auto; font-weight: 500; color: var(--text-light); font-size: 0.85rem; }
.sc-feature-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.sc-feature-list li { padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(100, 116, 139, 0.2); }
.sc-effect { font-size: 0.82rem; color: var(--text-light); margin-top: 2px; }
.sc-all-done { font-weight: 600; color: #047857; }
.sc-roadmap { list-style: none; display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.sc-roadmap li { display: flex; gap: 12px; padding: 6px 10px; border-radius: 8px; font-size: 0.9rem; }
.sc-roadmap li.sc-current { background: rgba(99, 102, 241, 0.14); font-weight: 600; }
.sc-rm-level { min-width: 44px; font-weight: 700; color: var(--primary-color); }
.sc-table-wrap { overflow-x: auto; }
.sc-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.sc-table th, .sc-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid rgba(100, 116, 139, 0.2); }
.sc-table th { color: var(--text-light); font-weight: 600; font-size: 0.8rem; }
.sc-table ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.sc-table tr.sc-current { background: rgba(99, 102, 241, 0.1); }
.sc-lv-cell { font-weight: 700; white-space: nowrap; }
.sc-now { font-size: 0.72rem; font-weight: 600; color: var(--primary-color); }
.sc-muted { color: var(--text-light); }
.sc-subtabs { display: flex; gap: 6px; margin-bottom: 10px; }
.sc-subtab { padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(100, 116, 139, 0.35); background: rgba(255, 255, 255, 0.6); cursor: pointer; font: inherit; font-weight: 600; color: var(--text-light); }
.sc-subtab.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.sc-filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sc-filter-row select, .sc-filter-row input { padding: 7px 10px; border-radius: 8px; border: 1px solid rgba(100, 116, 139, 0.4); font: inherit; max-width: 100%; background: #fff; }
.sc-filter-row input[type="search"] { flex: 1; min-width: 160px; }
.sc-bulk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 0.88rem; }
.sc-count { color: var(--text-light); margin-left: auto; }
.sc-q-list { display: flex; flex-direction: column; gap: 8px; }
.sc-q { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.65); border: 1px solid rgba(100, 116, 139, 0.2); }
.sc-q.in-central { opacity: 0.7; }
.sc-q-check input { width: 18px; height: 18px; accent-color: var(--primary-color); margin-top: 2px; }
.sc-q-main { flex: 1; min-width: 0; }
.sc-q-stem { color: var(--text-dark); line-height: 1.45; word-break: break-word; }
.sc-q-meta { display: flex; gap: 10px; font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }
.sc-q-done { color: #047857; font-weight: 600; }
.sc-q-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sc-chip { cursor: default; font-size: 0.74rem; }
.sc-chip-skill { background: rgba(14, 165, 233, 0.14); }
.sc-chip-tag { background: rgba(245, 158, 11, 0.16); }
@media (max-width: 600px) {
  .sc-tab { padding: 8px 10px; font-size: 0.88rem; }
  .sc-count { margin-left: 0; }
}
.sc-filter-row select { width: auto; flex: 1 1 170px; min-width: 0; }
.sc-filter-row input[type="search"] { width: auto; flex: 2 1 200px; }
.sc-bulk-row input[type="checkbox"] { width: auto; }
.sc-select-all { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ===================================================================
   Round H7：共享題庫面板
   =================================================================== */
.hub-badge { display: inline-block; min-width: 20px; margin-left: 8px; padding: 0 6px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 0.75rem; line-height: 20px; text-align: center; }
.hub-badge.hidden { display: none; }
/* H8：等級區的「共享題庫」圖示（徽章顯示待接受的分享數） */
.feature-chip.feature-chip-hub { border-style: dashed; }
.feature-chip .hub-badge { margin-left: 6px; min-width: 18px; line-height: 18px; font-size: 0.7rem; }
.sh-lock { text-align: center; padding: 36px 12px; color: var(--text-light); }
.sh-lock-icon { font-size: 2.4rem; }
.sh-lock h3 { margin: 8px 0 4px; color: var(--text-dark); }
.sh-pending-list { display: flex; flex-direction: column; gap: 8px; }
.sh-pending { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.65); border: 1px solid rgba(100, 116, 139, 0.2); }
.sh-pending-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sh-pending-actions, .sh-item-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.sh-pending-actions .btn, .sh-item-actions .btn { width: auto; }
.sh-group { margin: 12px 0; }
.sh-group-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sh-kind { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: rgba(99, 102, 241, 0.16); color: var(--primary-color); }
.sh-opts { margin-top: 4px; font-size: 0.82rem; color: var(--text-light); word-break: break-word; }
.sh-search, .sh-title { flex: 1 1 240px; width: auto; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(100, 116, 139, 0.4); font: inherit; background: #fff; }
.sh-results { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.sh-result { display: flex; justify-content: space-between; gap: 10px; text-align: left; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(100, 116, 139, 0.3); background: rgba(255, 255, 255, 0.7); cursor: pointer; font: inherit; }
.sh-result.active { border-color: var(--primary-color); background: rgba(99, 102, 241, 0.12); }
.sh-status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: rgba(100, 116, 139, 0.16); }
.sh-status-accepted { background: rgba(16, 185, 129, 0.16); color: #047857; }
.sh-status-pending { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.sh-status-declined, .sh-status-revoked { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.sc-hot-total { font-weight: 800; font-size: 1.2rem; color: var(--primary-color); text-align: center; }
