/* ============================================================
🎨 國家考試規格 - 主樣式表（整合版）
更新日期：2026-07-23
說明：整合系統主頁面內嵌樣式，移除重複，統一管理
移除：row-4E、row-5E 獨立定義（統一使用通用樣式）
============================================================ */

/* ============================================================
   全域重置
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
  font-size: 24px;
  background-color: #f0f2f5;
  color: #000;
  min-height: 100vh;
  overflow: hidden;
}

/* ============================================================
   頂部標題列
   ============================================================ */
#id_header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ===== 第1行：標題列 ===== */
.nav-top {
  background-color: #ffffff;
  text-align: center;
  padding: 0px 40px;
  color: #000;
  font-weight: bold;
  font-size: 22px;
  letter-spacing: 0px;
  border-bottom: 0px solid #d5c8a8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-top .title {
  font-weight: bold;
  font-size: 17px;
  letter-spacing: 0px;
  flex: 0 1 auto;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 20px;
  min-width: 0;
}

.nav-top .countdown-timer-top {
  font-size: 16px;
  font-weight: 700;
  color: #d32f2f;
  background: #fff;
  padding: 1px 0px;
  border: 3px solid #d32f2f;
  border-radius: 5px;
  flex-shrink: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ===== 第2行 + 第3行：考生資訊 ===== */
#toppanel,
#toppanel2 {
  width: 100%;
  background-color: #ffffff;
  padding: 4px 4px;
  font-size: 11px;
  font-weight: bold;
  color: #000;
  display: flex;
  align-items: center;
  border-bottom: 0px solid #d5c8a8;
}

#toppanel2 {
  border-bottom: none;
  padding-top: 1px;
  padding-bottom: 1px;
}

.toppanel-left {
  width: 330px;
  text-align: left;
  flex-shrink: 0;
}
.toppanel-center {
  width: 460px;
  text-align: left;
  flex-shrink: 0;
}
.toppanel-right {
  flex: 1;
  text-align: left;
}

#toppanel .label,
#toppanel2 .label {
  display: inline-block;
  width: 80px;
  text-align: right;
  margin-right: 6px;
  font-weight: normal;
  color: #333;
}
#toppanel .value,
#toppanel2 .value {
  font-weight: bold;
  color: #000;
}

#id_seat {
  color: #000;
  padding: 0px 0px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 11px;
  display: inline-block;
}

/* ============================================================
   工具列
   ============================================================ */
.toolbar-row-1 {
  background-color: #eaeaea;
  padding: 1px 0px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 513px;
  border-bottom: 0px solid #ccc;
  font-size: 15px;
  min-height: 30px;
}

.toolbar-row-2 {
  background-color: #eaeaea;
  padding: 0px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 4px;
  border-bottom: 0px solid #ccc;
  font-size: 10px;
  min-height: 20px;
}

.toolbar-row-3 {
  background-color: #a7a5a5;
  padding: 0px 0px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 8px;
  border-bottom: 0px solid #a7a5a5;
  font-size: 14px;
  min-height: 14px;
}

.toolbar-left-group {
  display: flex;
  align-items: center;
  gap: 6px 23px;
  flex-wrap: wrap;
}
.toolbar-left-group-2 {
  display: flex;
  align-items: center;
  gap: 6px 12px;
  flex-wrap: wrap;
}

.btn-align-right-1 {
  margin-left: 32px;
}
.btn-align-right-2 {
  margin-left: 220px;
}

.btn-official {
  padding: 0px 10px;
  background: #337ab7;
  border: 1px solid #1a3f6a;
  border-radius: 2px;
  font-size: 10px;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  color: #ffffff;
  border-color: #1a3f6a;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-official:hover {
  background: #1a3f6a;
  border-color: #888;
}
.btn-official.mode-btn {
  background: #e8e8e8;
  border-color: #bbb;
  color: #333;
}
.btn-official.mode-btn:hover {
  background: #d5d5d5;
}
.btn-official.mode-btn.active {
  background: #067ae0;
  color: #fff;
  border-color: #7a4522;
}
.btn-official.mode-btn.active:hover {
  background: #7a4522;
}
.btn-official.nav-btn {
  background: #337ab7;
  color: #ffffff;
  border-color: #1a3f6a;
}
.btn-official.nav-btn:hover {
  background: #1a3f6a;
  border-color: #0f2d4a;
}
.btn-official.danger {
  background: #e05046;
  color: #fff;
  border-color: #c04036;
}
.btn-official.danger:hover {
  background: #c04036;
}
.btn-official.primary {
  background: #337ab7;
  color: #fff;
  border-color: #1a3f6a;
}
.btn-official.primary:hover {
  background: #1a3f6a;
}
.btn-official.btn-next {
  background: #337ab7;
  color: #fff;
  border-color: #1a3f6a;
}
.btn-official.btn-next:hover {
  background: #1a3f6a;
  border-color: #0f2d4a;
}
.btn-official.success {
  background: #5cb85c;
  color: #fff;
  border-color: #4cae4c;
}
.btn-official.success:hover {
  background: #449d44;
  border-color: #398439;
}
.btn-official.toggle-btn {
  background: #a7a5a5;
  border-color: #a7a5a5;
  color: #ffffff;
  font-size: 12px;
  padding: 0px 0px;
  height: 15px;
  line-height: 0;
  border-radius: 3px;
  min-height: unset;
}
.btn-official.toggle-btn:hover {
  background: #a7a5a5;
}

.jump-select {
  padding: 0px 6px;
  border: 1px solid #aaa;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
  width: 46px;
  height: 24px;
  flex-shrink: 0;
}

.answered-display {
  font-size: 13px;
  font-weight: bold;
  color: #1a237e;
  background: #fff;
  padding: 1px 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
  flex-shrink: 0;
}

.timer {
  font-size: 14px;
  font-weight: 600;
  color: #d32f2f;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  background: #ccc;
  flex-shrink: 0;
}

/* ============================================================
   題目區
   ============================================================ */
#id_middle {
  position: fixed;
  top: 110px;
  bottom: 0;
  left: 0;
  right: 90px;
  background: rgb(255, 236, 169);
  overflow-y: auto;
  padding: 1px 10px;
  font-size: 14px;
  line-height: 1.5;
}

.question-container {
  max-width: 100%;
  background: rgb(255, 236, 169);
}
.question-card {
  background: rgb(255, 236, 169);
  padding: 1px 1px;
}

/* ============================================================
   row-1：題組標籤 + 題目文字（原始樣式不變）
   ============================================================ */
.row-1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 9px;
  padding-bottom: 7px;
  border-bottom: 0px solid #d5c8a8;
  margin-bottom: 10px;
  background: transparent;
}

/* ✅ row-1 內聯解析內容樣式（保留相容，但已被 row-1E 取代） */
.row-1 .explanation-container-inline {
  width: 100%;
  flex-basis: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  background: #f5edd6;
  border-radius: 6px;
  border-left: 4px solid #6b46c1;
  font-size: 15px;
  line-height: 1.6;
  box-sizing: border-box;
}

.row-1 .explanation-container-inline .section-label {
  font-weight: 700;
  font-size: 15px;
  color: #1a1a2e;
  padding: 4px 0;
  border-bottom: 1px solid #e8e4dc;
  margin-bottom: 4px;
}

.row-1 .explanation-container-inline .section-content {
  padding: 4px 0 8px 12px;
  font-size: 14px;
  line-height: 1.7;
  color: #333;
}

/* ============================================================
   row-2：題型標籤（原始樣式不變）
   ============================================================ */
.row-2 {
  margin-bottom: 7px;
}

.question-type-badge {
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0px;
  display: inline-block;
}
.question-type-badge.single {
  background: #337ab7;
}
.question-type-badge.multiple {
  background: #f0ad4e;
}
.question-type-badge.truefalse {
  background: #6a37e2;
}
.question-type-badge.calc {
  background: #871916;
}
.question-type-badge.fill {
  background: #387f38;
}
.question-type-badge.sequencing {
  background: #9e7911;
}
.question-type-badge.match {
  background: #aa58cd;
}
.question-type-badge.link {
  background: #4eb2d1;
}

/* ============================================================
   row-3：題幹標籤（原始樣式不變）
   ============================================================ */
.row-3 {
  background: #e05046;
  color: #fff;
  padding: 1px 9px;
  display: inline-block;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 0px;
}

/* ============================================================
   row-4：題幹提示文字（原始樣式不變）
   ============================================================ */
.row-4 {
  font-size: 15px;
  font-weight: 500;
  color: #000;
  margin-bottom: 6px;
}

/* ============================================================
   row-5：配分 + 標記按鈕
   ============================================================ */
.row-5 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  margin: 0;
  background: transparent;
  border: none;
  flex: 0 0 auto;
  flex-shrink: 0;
}

.row-5 .points {
  font-size: 15px;
  font-weight: 500;
  color: #000;
  display: inline-block;
  white-space: nowrap;
}

.row-5 .mark-btn {
  display: inline-block;
  padding: 2px 8px;
  margin-bottom: 0;
  font-size: 13px;
  font-weight: bold;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  background-color: #fff;
  background-image: none;
  border: 1px solid #ccc;
  border-radius: 0px;
  color: gray;
  box-shadow: rgba(51, 51, 102, 0.5) 3px 3px;
  transition: all 0.2s;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
  flex-shrink: 0;
}
.row-5 .mark-btn:hover {
  background-color: #f5f5f5;
  border-color: #aaa;
}
.row-5 .mark-btn.active {
  background: #eaeaea;
  border-color: #ccc;
  color: #f57f17;
  box-shadow: rgba(51, 51, 102, 0.5) 4px 4px;
}

/* ============================================================
   row-6：題目內容（原始樣式不變）
   ============================================================ */
.row-6 {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  font-size: 0px;
  color: #000;
  margin-bottom: 6px;
  padding: 0px 12px 0px 0px;
  line-height: 2;
  word-wrap: break-word;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  flex: 1;
  text-align: left;
  background: transparent;
  border-radius: 0;
}

.row-6 .number-badge {
  background: #777;
  color: #fff;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
  line-height: 2;
  height: fit-content;
  align-self: flex-start;
}

.row-6 .question-content {
  flex: 1;
  min-width: 0;
  text-align: left;
  align-self: flex-start;
}

.row-6 .question-content .q-text {
  font-weight: 500;
  font-size: 18px;
  line-height: 1.5;
  white-space: pre-wrap;
  text-align: left;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0 0px;
  letter-spacing: 1px;
  word-spacing: 1px;
}

.row-6 .question-content .q-points {
  font-weight: 600;
  color: #000;
}

/* ============================================================
   填充題內嵌樣式
   ============================================================ */
.fill-slot-inline {
  display: inline-block;
  min-width: 120px;
  padding: 2px 6px;
  background: #e8f5e9;
  border-bottom: 2px solid #2e7d32;
  margin: 0 2px;
  font-weight: 700;
  color: #2e7d32;
  text-align: center;
  border-radius: 4px 4px 0 0;
  font-size: 18px;
  line-height: 1.8;
}

/* ============================================================
   ✅ 解析區塊（row-1E ~ row-5E）- 統一通用樣式
   說明：每個解析區塊獨立顯示在對應的 row 下方
   特性：預設隱藏、統一格式、不同顏色邊框
   ============================================================ */

/* ===== 各解析區塊通用樣式 ===== */
.row-1E,
.row-2E,
.row-3E,
.row-4E,
.row-5E {
  display: none;
  flex: 0 0 auto;
  padding: 4px 10px;
  margin: 0;
  background: #f5f0eb;
  border-radius: 4px;
  border-left: 4px solid #6b46c1;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  box-sizing: border-box;
  align-items: center;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  flex-shrink: 0;
}

/* ===== 顯示狀態（由 JavaScript 切換） ===== */
.row-1E.show,
.row-2E.show,
.row-3E.show,
.row-4E.show,
.row-5E.show {
  display: flex;
}

/* ===== 各區塊不同顏色的左邊框 ===== */
.row-1E {
  border-left-color: #067ae0;
}
.row-2E {
  border-left-color: #6b46c1;
}
.row-3E {
  border-left-color: #f57c00;
}
.row-4E {
  border-left-color: #00897b;
}
.row-5E {
  border-left-color: #2e7d32;
}

/* ===== 解析區塊內部標題 ===== */
.row-1E .section-label,
.row-2E .section-label,
.row-3E .section-label,
.row-4E .section-label,
.row-5E .section-label {
  font-weight: 700;
  font-size: 12px;
  color: #1a1a2e;
  padding: 0 6px 0 0;
  margin: 0;
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== 解析區塊內部內容 ===== */
.row-1E .section-content,
.row-2E .section-content,
.row-3E .section-content,
.row-4E .section-content,
.row-5E .section-content {
  padding: 0 4px;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  display: inline;
}

/* ============================================================
   ✅ 解析按鈕樣式
   ============================================================ */
.btn-toggle-detail {
  padding: 4px 14px;
  background: #067ae0;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
  transition: background 0.2s;
  min-width: 100px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.btn-toggle-detail:hover {
  background: #7a4522;
}

/* ============================================================
   其他 row（保留用於擴充）
   ============================================================ */
.row-7 {
  padding: 4px 0 8px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.row-14 {
  margin-top: 6px;
}
.row-15,
.row-16,
.row-17 {
  margin-top: 4px;
}
.row-18 {
  margin-top: 1px;
  padding-top: 1px;
  border-top: 0px solid #d5c8a8;
  display: flex;
  justify-content: flex-start;
  gap: 10px;
}
.row-19 {
  margin-top: 6px;
}
.row-20 {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 0px solid #d5c8a8;
  display: flex;
  justify-content: flex-start;
  gap: 12px;
}
.row-22,
.row-23,
.row-24,
.row-25,
.row-26,
.row-27 {
  padding: 6px 0;
  border-bottom: 0px solid #f0ebe0;
}
.row-29 {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 0px solid #ffefa1;
  display: flex;
  justify-content: flex-start;
  gap: 12px;
}
.row-divider {
  margin: 8px 0;
  padding: 0;
}
.row-divider hr {
  border: none;
  border-top: 0px solid #d5c8a8;
  margin: 4px 0;
}

/* ============================================================
   選項卡片區
   ============================================================ */
.match-options-area {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 12px 16px;
  background: rgba(255, 239, 161, 0.5);
  border: none;
  border-radius: 4px;
  margin-bottom: 16px;
  min-height: 52px;
}
.match-option-card {
  padding: 4px 16px;
  background: rgba(255, 239, 161, 0.3);
  border: 1px solid #000;
  border-radius: 1px;
  font-size: 20px;
  font-weight: 600;
  color: #000;
  cursor: grab;
  user-select: none;
  transition: all 0.2s;
}
.match-option-card:hover {
  background: rgba(255, 239, 161, 0.8);
}
.match-option-card:active {
  cursor: grabbing;
}
.match-option-card.used {
  display: none;
}

.match-drop-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 36px;
  padding: 4px 0;
  max-width: 620px;
}
.match-drop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: #000;
  padding: 4px 0;
}
.match-drop-item .label {
  min-width: 36px;
  font-weight: 700;
  color: #000;
}
.match-drop-zone {
  flex: 1;
  min-width: 300px;
  padding: 6px 8px;
  background: rgba(255, 239, 161, 0.2);
  border: 1px solid #000;
  border-radius: 1px;
  font-size: 18px;
  color: #bbb;
  text-align: center;
  min-height: 40px;
  transition: all 0.2s;
  font-weight: 500;
  position: relative;
}
.match-drop-zone.filled {
  color: #000;
  font-weight: 600;
  background: rgba(255, 239, 161, 0.4);
}
.match-drop-zone.dragover {
  border-color: #067ae0;
  background: rgba(255, 239, 161, 0.7);
}
.match-drop-zone .underline {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  color: #bbb;
  font-size: 18px;
  letter-spacing: 2px;
  pointer-events: none;
}
.match-drop-item .points {
  font-size: 16px;
  font-weight: 600;
  color: #000;
  min-width: 42px;
  text-align: right;
}
.match-drop-item .clear-btn {
  background: none;
  border: none;
  color: #e05046;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  opacity: 0.2;
  transition: all 0.2s;
  font-weight: 700;
}
.match-drop-item .clear-btn:hover {
  opacity: 1;
}

.sort-section-title {
  font-size: 20px;
  font-weight: 700;
  color: #000;
  margin: 6px 0 4px 0;
}
.sort-answer-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0;
  background: transparent;
  align-items: flex-start;
  width: 100%;
}
.sort-answer-row {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 20px;
  padding: 8px 8px;
  background: #ffffff;
  border: 1px solid #d5c8a8;
  border-radius: 1px;
  min-height: 46px;
  width: 100%;
  max-width: 500px;
  cursor: grab;
  transition: all 0.2s;
}
.sort-answer-row:hover {
  background: #f5f5f5;
}
.sort-answer-row:active {
  cursor: grabbing;
}
.sort-answer-row .num {
  font-weight: 700;
  color: #1a1a2e;
  min-width: 36px;
}
.sort-answer-row .content {
  color: #bbb;
  font-weight: 400;
  flex: 1;
}
.sort-answer-row .content.filled {
  color: #1a1a2e;
  font-weight: 600;
}
.sort-answer-row .remove-btn {
  background: none;
  border: none;
  color: #e05046;
  cursor: pointer;
  font-size: 18px;
  padding: 0 6px;
  opacity: 0.4;
  transition: all 0.2s;
}
.sort-answer-row .remove-btn:hover {
  opacity: 1;
}

.sort-options-area {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 10px;
  background: rgb(255, 236, 169);
  border: 0px solid #b5a88a;
  border-radius: 6px;
  margin-top: 10px;
  min-height: 60px;
  width: 100%;
  max-width: 1200px;
}
.sort-option-card {
  padding: 6px 40px;
  background: rgb(255, 236, 169);
  border: 1px solid #888;
  border-radius: 1px;
  font-size: 20px;
  cursor: grab;
  user-select: none;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.sort-option-card:hover {
  background: #f0f0f0;
  border-color: #555;
}
.sort-option-card:active {
  cursor: grabbing;
}
.sort-option-card.hidden {
  display: none;
}

.fill-input-area {
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 40px 0;
  width: 100%;
}
.fill-input-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 22px;
}
.fill-input-row .label {
  font-weight: 700;
  color: #1a1a2e;
  min-width: 40px;
}
.fill-input-row input {
  display: inline-block;
  min-width: 120px;
  max-width: 360px;
  padding: 1px 12px;
  background: #ffffff;
  border: none;
  border-bottom: 1px solid #2e7d32;
  font-size: 22px;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
  text-align: center;
  color: #1a1a2e;
  transition: all 0.2s;
  border-radius: 4px 4px 0 0;
  outline: none;
}
.fill-input-row input:focus {
  border-bottom-color: #067ae0;
  background: #f5f5f5;
}
.fill-input-row input::placeholder {
  color: #bbb;
  font-size: 18px;
  font-weight: 400;
}

.options-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
  background: transparent;
  align-items: flex-start;
  width: 100%;
}
.option-label {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  gap: 12px;
  font-size: 20px;
  width: 100%;
  max-width: 700px;
  text-align: left;
  transition: all 0.2s;
}
.option-label:hover {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
}
.option-label input[type='radio'] {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border: 2px solid #888;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s;
}
.option-label input[type='radio']:checked {
  border-color: #067ae0;
}
.option-label input[type='radio']:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 9px;
  height: 9px;
  background: #067ae0;
  border-radius: 50%;
}
.option-label input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 2px solid #888;
  border-radius: 2px;
  background: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s;
}
.option-label input[type='checkbox']:checked {
  border-color: #067ae0;
  background: #067ae0;
}
.option-label input[type='checkbox']:checked::after {
  content: '✓';
  position: absolute;
  top: -4px;
  left: 0px;
  font-size: 15px;
  color: #fff;
}
.option-marker {
  font-size: 18px;
  font-weight: 600;
  color: #555;
  min-width: 32px;
  text-align: left;
}
.option-text {
  font-size: 18px;
  color: #333;
  flex: 1;
  text-align: left;
}

.truefalse-options {
  display: flex;
  flex-direction: row;
  gap: 40px;
  justify-content: flex-start;
  align-items: center;
  padding: 4px 0;
  background: transparent;
}
.truefalse-options .tf-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 600;
  color: #1a1a2e;
  cursor: pointer;
  background: transparent;
  padding: 4px 8px;
  transition: all 0.2s;
}
.truefalse-options .tf-label:hover {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
}
.truefalse-options .tf-label input[type='radio'] {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border: 2px solid #888;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s;
}
.truefalse-options .tf-label input[type='radio']:checked {
  border-color: #067ae0;
}
.truefalse-options .tf-label input[type='radio']:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 9px;
  height: 9px;
  background: #067ae0;
  border-radius: 50%;
}

.calc-answer-area {
  padding: 12px 0;
  background: transparent;
}
.calc-input {
  display: block;
  width: 100%;
  max-width: 540px;
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid #b5a88a;
  border-radius: 1px;
  font-size: 18px;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
  color: #1a1a2e;
  transition: all 0.3s;
  min-height: 36px;
}
.calc-input:focus {
  outline: none;
  border-color: #067ae0;
  box-shadow: 0 0 0 3px rgba(157, 90, 44, 0.15);
}

.link-container {
  display: flex;
  gap: 120px;
  padding: 12px 0;
  flex-wrap: wrap;
  background: transparent;
  align-items: flex-start;
}
.link-left,
.link-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 200px;
}
.link-left .title,
.link-right .title {
  font-weight: 700;
  font-size: 18px;
  color: #1a1a2e;
  margin-bottom: 4px;
}
.link-item {
  padding: 30px 30px;
  min-width: 230px;
  background: #ffffff;
  border: 1px solid #b5a88a;
  border-radius: 1px;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.link-item:hover {
  background: #f5edd6;
  border-color: #067ae0;
}
.link-item.selected {
  background: #d4c8a8;
  border-color: #067ae0;
}
.link-item.matched {
  background: #e8f5e9;
  border-color: #2e7d32;
  cursor: default;
  opacity: 0.8;
}

.link-image-upload {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.link-image-upload label {
  padding: 4px 14px;
  background: #067ae0;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
}
.link-image-upload label:hover {
  background: #7a4522;
}
.link-image-upload input[type='file'] {
  display: none;
}
.link-image-upload img {
  max-height: 60px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* ============================================================
   螢幕小鍵盤
   ============================================================ */
.virtual-keyboard {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(145deg, #f5f3ef, #e8e4dc);
  border: 2px solid #c8bda8;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  padding: 6px 10px;
  z-index: 9999;
  display: none;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
}
.virtual-keyboard.active {
  display: block;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}
.keyboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px 4px 2px;
  border-bottom: 0px solid #d5cdbc;
  margin-bottom: 4px;
}
.keyboard-title {
  font-size: 12px;
  font-weight: 700;
  color: #1a3a5c;
}
.keyboard-close {
  background: #8a8a8a;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 0 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.6;
}
.keyboard-close:hover {
  background: #6a6a6a;
}
.keyboard-row {
  display: flex;
  gap: 3px;
  justify-content: center;
  flex-wrap: nowrap;
}
.key-btn {
  padding: 4px 6px;
  min-width: 28px;
  height: 28px;
  background: #fff;
  border: 1px solid #c8bda8;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #222;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
}
.key-btn:hover {
  background: #e8f0fe;
  border-color: #067ae0;
  transform: translateY(-1px);
}
.key-btn:active {
  transform: translateY(0);
  background: #d0d8e8;
}
.key-btn.num {
  background: #fff;
  font-size: 14px;
  min-width: 30px;
}
.key-btn.control {
  background: #e8e4dc;
  font-size: 12px;
  min-width: 40px;
  color: #333;
  font-weight: 600;
}
.key-btn.clear-key {
  background: #f5e8e8;
  color: #e05046;
  font-weight: 700;
  min-width: 40px;
}
.key-btn.enter-key {
  background: #067ae0;
  color: #fff;
  border-color: #7a4522;
  min-width: 46px;
  font-size: 13px;
}

/* ============================================================
   浮動按鈕
   ============================================================ */
.float-btn-group {
  position: fixed;
  right: 16px;
  bottom: 120px;
  z-index: 9997;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.float-btn-group button {
  padding: 8px 8px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  min-width: 70px;
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
  text-align: center;
}
.float-btn-group button:hover {
  transform: scale(1.05);
}
.btn-calc-float {
  background: #1a237e;
  color: #fff;
}
.btn-calc-float.active {
  background: #ff6f00;
  box-shadow: 0 0 0 3px #ffd54f;
}
.btn-wb-float {
  background: #37474f;
  color: #fff;
}
.btn-wb-float.active {
  background: #ff6f00;
  box-shadow: 0 0 0 3px #ffd54f;
}

/* ============================================================
   計算機（拖曳欄獨立）- 最終無圓角顯示區版
   ============================================================ */
/* ===== 計算機外層包裝 ===== */
#calculatorWrapper {
  position: fixed;
  right: 120px;
  bottom: 180px;
  z-index: 9998;
  display: none;
  flex-direction: column;
  align-items: flex-end;
}
#calculatorWrapper.visible {
  display: flex !important;
}

/* ===== 拖曳欄 ===== */
.calc-header {
  background: transparent !important;
  padding: 0px 0px 0px 0px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none !important;
  border-bottom: none !important;
  outline: none !important;
  box-shadow: none !important;
  cursor: default; /* ✅ 改為 default，拖曳由 drag-handle 控制 */
  user-select: none;
  width: 372px;
  margin-bottom: 2px;
  border-radius: 0px !important;
}
.calc-header .drag-handle {
  cursor: grab;
  color: rgb(0, 0, 0);
  font-size: 18px;
  padding: 0px 3px;
  user-select: none;
  transition: all 0.2s;
  border: 3px solid rgb(0, 0, 0); /* ✅ 外框 */
  border-radius: 6px;
  line-height: 2;
  background: rgba(255, 255, 255, 0);
}
.calc-header .drag-handle:hover {
  color: #727272;
  border-color: #727272;
  background: rgba(255, 255, 255, 0);
}

.calc-header .title {
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
}
.calc-header .close-btn {
  background: rgba(255, 255, 255, 0);
  border: 3px solid #3f86c2;
  border-radius: 6px;
  color: #3f86c2;
  font-size: 20px; /* ✅ 稍微調大 */
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
  width: 29px; /* ✅ 固定寬度 */
  height: 29px; /* ✅ 固定高度 */
  display: flex; /* ✅ 置中對齊 */
  align-items: center; /* ✅ 垂直置中 */
  justify-content: center; /* ✅ 水平置中 */
  line-height: 1.5;
}
.calc-header .close-btn:hover {
  color: #00467e;
  border-color: #00467e;
  background: rgba(255, 255, 255, 0);
}

/* ===== 計算機主體 - 用 flex 分開顯示區和按鈕區 ===== */
#calculatorContainer {
  width: 372px;
  background: transparent; /* 背景透明，由子元件各自控制 */
  border-radius: 14px;
  box-shadow: none !important; /* ✅ 移除陰影 */
  overflow: visible; /* ✅ 改為 visible，讓子元件各自控制圓角 */
  border: none;
  font-family: '微軟正黑體', 'Microsoft JhengHei', 'Segoe UI', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  z-index: 9999 !important;
}

/* ===== 計算機顯示區（強制無圓角） ===== */
.calc-display {
  background: #1d1d1d;
  padding: 0px 12px 2px 0px;
  text-align: right;
  min-height: 60px;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  border-radius: 0px !important;
  border-top-left-radius: 0px !important;
  border-top-right-radius: 0px !important;
  border-bottom-left-radius: 0px !important;
  border-bottom-right-radius: 0px !important;
  /* ✅ 加上外框的上半部，維持視覺一致性 */
  border: 0px solid rgba(255, 255, 255, 0.15);
  border-bottom: none;
}

/* 第一欄：公式顯示 */
.calc-formula {
  font-size: 24px !important;
  color: #d3d3d3b4 !important;
  min-height: 42px !important; /* ✅ 強制最小高度 */
  height: 45px !important; /* ✅ 強制固定高度 */
  word-break: break-all;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif !important;
  text-align: right;
  padding: 4px 0 0px 0;
  line-height: 42px !important; /* ✅ 行高等於高度，垂直置中 */
  font-weight: 500;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  overflow: hidden; /* ✅ 防止內容溢出 */
}

/* 第二欄：答案顯示 */
.calc-result {
  font-size: 30px !important;
  font-weight: 500 !important;
  color: #ffffff !important;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif !important;
  text-align: right;
  min-height: 38px !important;
}

/* ===== 按鈕區域（有圓角） ===== */
.calc-buttons {
  background: #ffffff;
  padding: 1px 1px 1px 1px;
  display: flex;
  flex-direction: column;
  gap: 1.5px;
  border-radius: 0 0 24px 24px;
  overflow: hidden;
  /* ✅ 加上外框的下半部 */
  border: 1px solid rgb(0, 0, 0);
  border-top: none;
}
.calc-row {
  display: flex;
  gap: 3px;
}

/* ===== 按鈕通用樣式 ===== */
.calc-btn {
  flex: 1;
  padding: 9px 0;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  background: #f0f0f0;
  color: #222;
  cursor: pointer;
  transition: all 0.08s;
  font-family: '微軟正黑體', 'Microsoft JhengHei', 'Segoe UI', Arial, sans-serif;
  min-height: 34px;
  text-align: center;
}
.calc-btn:hover {
  background: #e0e0e0;
}
.calc-btn:active {
  background: #ccc;
  transform: scale(0.92);
}

/* ===== 按鈕類型 ===== */
.calc-btn.num {
  background: #ffffff;
  font-weight: 500;
  font-size: 18px;
}
.calc-btn.operator {
  background: #ffffff;
  color: #31b89a;
  font-weight: 700;
  font-size: 20px;
}
.calc-btn.func {
  background: #ffffff;
  font-weight: 500;
  font-size: 17px;
  color: #000000;
}
.calc-btn.equals {
  background: #46e0bc;
  color: #ffffff;
  font-weight: 700;
  font-size: 20px;
  flex: 2.01;
  border-radius: 30px;
  box-shadow: 0 2px 8px rgba(70, 224, 188, 0.3);
}
.calc-btn.clear {
  background: #ffffff;
  font-size: 20px;
  color: #000000;
  font-weight: 500;
}
/* ===== 退格按鈕（圓形 + 可調尺寸） ===== */
.calc-btn.backspace {
  background: #e05046;
  font-size: 21px;
  color: #ffffff;
  font-weight: 300;
  border: none;
  border-radius: 50% !important; /* ✅ 強制圓形 */
  width: var(--backspace-size, 43px); /* ✅ 可調寬度（預設 48px） */
  height: var(--backspace-size, 43px); /* ✅ 可調高度（預設 48px） */
  min-width: unset; /* 移除最小寬度限制 */
  min-height: unset; /* 移除最小高度限制 */
  padding: 0; /* 移除內距，讓文字置中 */
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto; /* 不伸縮，保持固定尺寸 */
  line-height: 1;
  transition: all 0.08s;
  cursor: pointer;
  font-family: '微軟正黑體', 'Microsoft JhengHei', 'Segoe UI', Arial, sans-serif;
}
.calc-btn.backspace:hover {
  background: #c0392b;
  transform: scale(1.05);
}
.calc-btn.backspace:active {
  transform: scale(0.92);
}
/* ============================================================
    白板（強制覆蓋版 - 修復尺寸問題）
    ============================================================ */
#whiteboardContainer {
  position: fixed !important;
  /* top 和 left 由 JS 動態控制，移除固定值 */
  width: 500px !important;
  height: 500px !important;
  max-width: 90vw !important;
  max-height: 80vh !important;
  background: #ffffff !important;
  border: 2px solid #1a237e !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
  z-index: 9997 !important;
  display: none;
  flex-direction: column !important;
  overflow: hidden !important;
}

#whiteboardContainer.visible {
  display: flex !important;
}

/* 白板內部元素 */
#whiteboardContainer .wb-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 0px 4px !important;
  background: transparent !important; /* ✅ 改為透明 */
  color: #ffffff !important;
  flex-shrink: 0 !important;
  cursor: grab !important;
  user-select: none !important;
}

#whiteboardContainer .wb-header .drag-handle {
  cursor: grab !important;
  color: rgba(255, 255, 255, 0.6) !important;
  font-size: 14px !important;
  padding: 4px 8px !important;
}

#whiteboardContainer .wb-header .title {
  font-size: 15px !important;
  font-weight: 600 !important;
}

#whiteboardContainer .wb-header .close-btn {
  background: rgba(255, 255, 255, 0.2) !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 18px !important;
  cursor: pointer !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#whiteboardContainer .wb-header .close-btn:hover {
  background: rgba(255, 255, 255, 0.4) !important;
}

#whiteboardContainer .wb-toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0px 2px !important;
  padding: 2px 10px !important;
  background: #f5f5f5 !important;
  border-bottom: 1px solid #ddd !important;
  flex-shrink: 0 !important;
}

#whiteboardContainer .wb-toolbar button {
  padding: 4px 12px !important;
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  background: #ffffff !important;
  cursor: pointer !important;
  font-size: 13px !important;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif !important;
}

#whiteboardContainer .wb-toolbar button.active {
  background: #1a237e !important;
  color: #ffffff !important;
  border-color: #1a237e !important;
}

#whiteboardContainer .wb-toolbar .color-picker {
  width: 30px !important;
  height: 30px !important;
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  padding: 2px !important;
}

#whiteboardContainer .wb-toolbar .size-select {
  padding: 4px 8px !important;
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  font-size: 13px !important;
  background: #ffffff !important;
  cursor: pointer !important;
}

#whiteboardContainer .wb-toolbar .status {
  font-size: 12px !important;
  color: #666 !important;
  margin-left: auto !important;
}

#whiteboardContainer .wb-canvas-wrapper {
  flex: 1 !important;
  padding: 2px !important;
  background: #ffffff !important;
  overflow: hidden !important;
  min-height: 0 !important;
}

#whiteboardContainer .wb-canvas-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  background: #ffffff !important;
  cursor: crosshair !important;
  display: block !important;
  touch-action: none !important;
}

/* ============================================================
   作答總覽
   ============================================================ */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99999;
  justify-content: center;
  align-items: center;
}
.overlay.active {
  display: flex;
}
.overlay-content {
  background: #fff;
  border-radius: 12px;
  padding: 30px 40px;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.overlay-content h2 {
  font-size: 28px;
  margin-bottom: 20px;
  color: #1a1a2e;
  border-bottom: 0px solid #e8e4dc;
  padding-bottom: 12px;
}
.overlay-content .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.overlay-content .grid .item {
  padding: 10px 0;
  text-align: center;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: #f5f5f5;
  border: 2px solid #e8e4dc;
}
.overlay-content .grid .item.answered {
  background: #48bb78;
  border-color: #38a169;
  color: #fff;
}
.overlay-content .grid .item.current {
  border-color: #067ae0;
  box-shadow: 0 0 0 3px rgba(157, 90, 44, 0.3);
}
.overlay-content .grid .item.marked {
  background: #ffd54f;
  border-color: #f57f17;
  color: #333;
}
.overlay-close-btn {
  padding: 10px 30px;
  background: #067ae0;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 20px;
  cursor: pointer;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
}

/* ============================================================
   響應式設計
   ============================================================ */
@media (max-width: 1024px) {
  #id_middle {
    right: 80px;
    padding: 0px 0px;
  }
  #calculatorContainer {
    width: 300px;
    right: 90px;
    bottom: 160px;
  }
  #whiteboardContainer {
    width: 320px;
    height: 360px;
    right: 90px;
    bottom: 160px;
  }
  .float-btn-group {
    right: 10px;
    bottom: 70px;
  }
  .float-btn-group button {
    min-width: 60px;
    font-size: 12px;
    padding: 6px 10px;
  }
}
@media (max-width: 768px) {
  #id_header {
    position: relative;
  }
  #id_middle {
    position: relative;
    top: 0;
    padding: 12px 16px;
    font-size: 18px;
    right: 60px;
    bottom: 0;
    height: auto;
    min-height: calc(100vh - 380px);
  }
  .nav-top {
    font-size: 18px;
    padding: 10px;
    flex-direction: column;
    gap: 4px;
  }
  .nav-top .title {
    font-size: 18px;
  }
  .nav-top .countdown-timer-top {
    font-size: 14px;
    padding: 2px 8px;
  }
  #toppanel,
  #toppanel2 {
    font-size: 14px;
    flex-direction: column;
    gap: 4px;
    padding: 6px 12px;
  }
  .toolbar-row-1,
  .toolbar-row-2,
  .toolbar-row-3 {
    font-size: 13px;
    padding: 4px 10px;
    gap: 4px 8px;
  }
  .btn-official {
    font-size: 13px;
    padding: 3px 10px;
    height: 30px;
  }
  .row-1 .question-text-label {
    font-size: 16px;
  }
  .row-4 {
    font-size: 18px;
  }
  .row-6 {
    font-size: 18px;
  }
  .option-label {
    font-size: 16px;
    padding: 4px 8px;
  }
  .calc-input {
    max-width: 100%;
    font-size: 18px;
  }
  #calculatorContainer {
    width: 260px;
    right: 70px;
    bottom: 60px;
  }
  #whiteboardContainer {
    width: 280px;
    height: 300px;
    right: 70px;
    bottom: 60px;
  }
  .float-btn-group {
    right: 5px;
    bottom: 60px;
  }
  .float-btn-group button {
    min-width: 50px;
    font-size: 11px;
    padding: 5px 8px;
  }
  .link-container {
    gap: 70px;
    flex-direction: column;
  }
  /* ✅ 小螢幕時解析區塊調整 */
  .row-1E,
  .row-2E,
  .row-3E,
  .row-4E,
  .row-5E {
    font-size: 12px;
    padding: 4px 10px;
  }
}

/* ============================================================
   🆕 模式選擇畫面完整樣式（從系統主頁面整合而來）
   ============================================================ */
#modeSelectScreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #1a237e 0%, #0d47a1 50%, #01579b 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif;
}

#modeSelectScreen .mode-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  padding: 40px 40px;
  max-width: 600px;
  width: 80%;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: fadeInUp 0.6s ease;
}

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

#modeSelectScreen .mode-title {
  font-size: 32px;
  font-weight: 700;
  color: #1a237e;
  margin-bottom: 4px;
  letter-spacing: 2px;
}

#modeSelectScreen .mode-subtitle {
  font-size: 15px;
  color: #171616;
  margin-top: 8px;
  margin-bottom: 30px;
  letter-spacing: 1px;
  line-height: 1.5;
  padding: 4px 0;
}

/* ===== 模式按鈕群組 ===== */
#modeSelectScreen .mode-btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
}

#modeSelectScreen .mode-btn-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  font-family: inherit;
  border: 1px solid transparent;
  background: #f5f5f5;
}

#modeSelectScreen .mode-btn-item:hover {
  transform: scale(1.02);
}

#modeSelectScreen .mode-btn-item .mode-icon {
  font-size: 28px;
  flex-shrink: 0;
}

#modeSelectScreen .mode-btn-item .mode-info {
  flex: 1;
  text-align: left;
  margin-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

#modeSelectScreen .mode-btn-item .mode-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

#modeSelectScreen .mode-btn-item .mode-desc {
  font-size: 11px;
  color: #555;
  line-height: 1.2;
}

#modeSelectScreen .mode-btn-item .mode-stats {
  text-align: right;
  flex-shrink: 0;
}
#modeSelectScreen .mode-btn-item .mode-count {
  font-size: 16px;
  font-weight: 700;
}
#modeSelectScreen .mode-btn-item .mode-time {
  font-size: 12px;
  color: #463530;
}

#modeSelectScreen .mode-btn-item.academic {
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  border-color: #1a237e;
}
#modeSelectScreen .mode-btn-item.academic .mode-name {
  color: #1a237e;
}
#modeSelectScreen .mode-btn-item.academic .mode-count {
  color: #1a237e;
}

#modeSelectScreen .mode-btn-item.technical {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border-color: #e65100;
}
#modeSelectScreen .mode-btn-item.technical .mode-name {
  color: #e65100;
}
#modeSelectScreen .mode-btn-item.technical .mode-count {
  color: #e65100;
}

#modeSelectScreen .mode-btn-item.calc {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border-color: #1b5e20;
}
#modeSelectScreen .mode-btn-item.calc .mode-name {
  color: #1b5e20;
}
#modeSelectScreen .mode-btn-item.calc .mode-count {
  color: #1b5e20;
}

#modeSelectScreen .mode-footer {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 0px solid #e8e8e8;
  font-size: 16px;
  color: #1b3f41;
}

#modeSelectScreen .mode-footer span {
  margin: 1 4px;
}

#modeSelectScreen .btn-back {
  background: #795548;
  border-color: #4e342e;
  color: #fff;
}

#modeSelectScreen .btn-back:hover {
  background: #5d4037;
  border-color: #3e2723;
}

/* 模式按鈕在工具列隱藏 */
.toolbar-row-1 .mode-btn {
  display: none;
}

/* ============================================================
   解析區相關樣式（保留相容性）
   ============================================================ */
.row-14 .explanation-container {
  display: none;
  padding: 10px 16px;
  background: #f5edd6;
  border-radius: 6px;
  border-left: 4px solid #6b46c1;
  font-size: 18px;
  line-height: 1.6;
  text-align: left;
}
.row-14 .explanation-container.active {
  display: block;
}
.row-14 .explanation-container .label {
  font-weight: 600;
  color: #6b46c1;
}

.detail-section {
  border: 1px solid #e8e4dc;
  border-radius: 4px;
  background: #faf8f5;
  overflow: hidden;
}
.detail-header {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
  gap: 8px;
}
.detail-header:hover {
  background: #f0ede8;
}
.detail-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.detail-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  flex: 1;
}
.detail-toggle {
  font-size: 12px;
  color: #888;
  transition: transform 0.3s;
  flex-shrink: 0;
}
.detail-toggle.open {
  transform: rotate(90deg);
}
.detail-content {
  padding: 8px 14px 10px 14px;
  font-size: 15px;
  line-height: 1.6;
  color: #333;
  background: #fff;
  border-top: 0px solid #e8e4dc;
  display: none;
}
.detail-content.open {
  display: block;
}

.law-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}
.law-line {
  padding: 3px 0;
  font-size: 15px;
  line-height: 1.7;
  color: #333;
}
.law-line strong {
  color: #1a237e;
  font-weight: 700;
}
.law-line a {
  color: #067ae0;
  text-decoration: none;
}
.law-line a:hover {
  text-decoration: underline;
  color: #7a4522;
}
.law-line:nth-child(2) {
  padding: 6px 12px;
  background: #f5f0e8;
  border-radius: 4px;
  margin: 2px 0;
}
.law-line:nth-child(3) {
  font-size: 14px;
}
.law-line:nth-child(4) {
  color: #555;
  font-size: 14px;
  border-top: 0px dashed #e0d8cc;
  padding-top: 6px;
  margin-top: 2px;
}

.logic-tag {
  display: inline-block;
  padding: 1px 10px;
  margin: 2px 3px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  background: #f5f0eb;
  border: 1px solid #ddd;
  transition: all 0.2s;
}
.logic-tag:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.calc-tips-container {
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}
.calc-tips-container .formula-line {
  display: block;
  padding: 2px 0;
  font-weight: 600;
  color: #1a237e;
}
.calc-tips-container .var-line {
  display: block;
  padding: 1px 0 1px 16px;
  font-size: 13px;
  color: #333;
}
.calc-tips-container .constant-line {
  display: block;
  padding: 2px 0 2px 16px;
  font-size: 13px;
  color: #555;
  border-left: 3px solid #3498db;
  background: #f8f9fa;
  border-radius: 0 4px 4px 0;
  margin: 2px 0;
}
.calc-tips-container .keyboard-line {
  display: block;
  padding: 4px 0 4px 16px;
  font-family: 'Courier New', monospace;
  background: #f0f0f0;
  border-radius: 4px;
  margin: 2px 0;
  color: #222;
}
.calc-tips-container .logic-line {
  display: block;
  padding: 2px 0;
  color: #666;
  font-style: italic;
}

.logic-display-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 6px 0;
}
.logic-display-area .label {
  font-weight: 600;
  color: #555;
  font-size: 14px;
}

.section-label {
  font-weight: 700;
  font-size: 16px;
  color: #1a1a2e;
  margin-bottom: 4px;
  padding: 4px 0;
  border-bottom: 2px solid #e8e4dc;
  display: block;
}

.law-section,
.tips-section,
.logic-section,
.answer-section {
  background: #f8f6f0;
  border-radius: 4px;
  padding: 8px 12px;
  border-left: 3px solid #067ae0;
}
.law-section {
  border-left-color: #6b46c1;
}
.tips-section {
  border-left-color: #f57c00;
}
.logic-section {
  border-left-color: #00897b;
}
.answer-section {
  border-left-color: #2e7d32;
}

.section-content {
  padding: 8px 12px;
  background: #f8f6f0;
  border-radius: 4px;
  border-left: 3px solid #067ae0;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  margin-top: 2px;
}
#lawContent {
  border-left-color: #6b46c1;
}
#tipContent {
  border-left-color: #f57c00;
}
#logicContent {
  border-left-color: #00897b;
}
#answerContent {
  border-left-color: #2e7d32;
}
#explanationText {
  border-left-color: #067ae0;
}

.tips-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tips-quick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  background: #f0f7ff;
  border-radius: 6px;
  border-left: 3px solid #067ae0;
}
.tips-item {
  font-size: 15px;
  line-height: 1.6;
  color: #1a1a2e;
}
.tips-mnemonic {
  padding: 10px 14px;
  background: #e8f5e9;
  border-radius: 6px;
  border-left: 3px solid #2e7d32;
  font-size: 16px;
  font-weight: 600;
  color: #1b5e20;
  line-height: 1.6;
}
.tips-story {
  padding: 8px 14px;
  background: #fff8e1;
  border-radius: 6px;
  border-left: 3px solid #f57f17;
  font-size: 15px;
  line-height: 1.7;
  color: #333;
}
.tips-mistake {
  padding: 10px 14px;
  background: #fce4ec;
  border-radius: 6px;
  border-left: 3px solid #c62828;
  font-size: 15px;
  line-height: 1.7;
  color: #333;
}
.tips-traps {
  margin-top: 4px;
  padding: 12px 16px;
  background: #fff3e0;
  border-left: 4px solid #e65100;
  border-radius: 6px;
}
.traps-title {
  font-weight: 700;
  font-size: 16px;
  color: #e65100;
  margin-bottom: 6px;
}
.trap-item {
  padding: 6px 0 6px 4px;
  font-size: 15px;
  line-height: 1.7;
  color: #333;
  border-bottom: 0px dashed #ffe0b2;
}
.trap-item:last-child {
  border-bottom: none;
}

.law-detail a {
  color: #067ae0;
  text-decoration: none;
  font-weight: 500;
}
.law-detail a:hover {
  text-decoration: underline;
  color: #7a4522;
}

.logic-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px;
  background: #f5f0eb;
  border-radius: 4px;
  margin-bottom: 4px;
}
.logic-label {
  font-weight: 700;
  font-size: 14px;
  color: #1a237e;
}
.logic-reason {
  font-size: 14px;
  color: #555;
  line-height: 1.5;
}

#optionsCardArea {
  min-height: 70px;
  padding: 0px 0px;
  background: transparent;
  border: 0px dashed #b5a88a;
  border-radius: 6px;
  margin: 4px 0;
}

#dropTargetArea {
  min-height: 80px;
  padding: 0px 0px;
  background: rgb(255, 236, 169);
  border: 0px solid #d5c8a8;
  border-radius: 6px;
  margin: 4px 0;
}
/* ============================================================
📐 公式拆解按鈕（由 14_解析_主引擎.js 生成）
============================================================ */
.btn-logic-formula {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 0px 18px !important;
  height: 24px !important;
  background: #6832c2db !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 4px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  font-family: '微軟正黑體', 'Microsoft JhengHei', Arial, sans-serif !important;
  cursor: pointer !important;
  transition:
    background 0.2s,
    transform 0.1s !important;
  box-shadow: 0 2px 8px rgba(26, 35, 126, 0.3) !important;
  white-space: nowrap !important;
}

.btn-logic-formula:hover {
  background: #0d47a1 !important;
  transform: scale(1.02);
}

.btn-logic-formula:active {
  transform: scale(0.97);
}

/* 旁邊的「(點擊查看完整步驟)」文字 */
.btn-logic-formula + span {
  font-size: 12px !important;
  color: #1a237e !important;
  margin-left: 6px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
}
