/* ================================== 基础样式重置 ================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ================================== 自定义颜色系统 ================================== */
.bg-primary { background-color: #3b82f6 !important; }
.text-primary { color: #3b82f6 !important; }
.ring-primary { --tw-ring-color: #3b82f6 !important; }

.bg-secondary { background-color: #64748b !important; }
.text-secondary { color: #64748b !important; }

.bg-accent { background-color: #10b981 !important; }
.text-accent { color: #10b981 !important; }

.bg-done { background-color: #dbeafe !important; }
.text-done { color: #dbeafe !important; }
.bg-done-correct { background-color: #d1fae5 !important; }
.text-done-correct { color: #059669 !important; }
.bg-done-incorrect { background-color: #fee2e2 !important; }
.text-done-incorrect { color: #dc2626 !important; }

.bg-disabled { background-color: #e5e7eb !important; }
.text-disabled { color: #9ca3af !important; }

.text-blue-800 { color: #1e40af !important; }
.text-green-800 { color: #065f46 !important; }
.text-red-800 { color: #991b1b !important; }

/* ================================== 自定义工具类 ================================== */
/* 1. 表单交互类 */
.radio-focus {
  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
  --tw-ring-color: #3b82f6;
  --tw-ring-offset-width: 2px;
}

/* 2. 组号导航按钮（左侧） */
.number-btn {
  width: 100%;
  padding: 0.5rem;
  background-color: #f3f4f6;
  color: #3b82f6;
  border-radius: 0.25rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.15rem;
  font-weight: 500;
  text-align: center;
  border: none;
  outline: none;
  cursor: pointer;
}

/* 已做完的组 */
.number-btn-done {
  background-color: #dbeafe;
  color: #1e40af;
}

/* 🔥 核心修复：当前选中组 优先级最高 */
.number-btn.number-btn-active {
  background-color: #3b82f6 !important;
  color: #fff !important;
  font-weight: bold !important;
}

.number-btn:hover {
  background-color: #3b82f6;
  color: #fff;
}

/* 3. 顶部功能按钮（导航/模式切换等） */
.theme-toggle-btn {
    min-width: 120px;
    width: 120px;
}

.nav-btn,
.reset-btn,
.mode-toggle-btn,
.theme-toggle-btn,
.question-type-toggle-btn,
.group-size-toggle-btn,
.upload-btn,
.exam-countdown,
.score-display,
.current-question-display {
  padding: 0.375rem 0.75rem;
  background-color: #3b82f6;
  color: #ffffff;
  border-radius: 0.375rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.2rem;   
  font-weight: 500;
  border: none;
  outline: none;
  cursor: pointer;
  margin: 0 2px;  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
}

.nav-btn:hover,
.reset-btn:hover,
.mode-toggle-btn:hover,
.theme-toggle-btn:hover,
.question-type-toggle-btn:hover,
.group-size-toggle-btn:hover,
.upload-btn:hover,
.exam-countdown:hover {
  background-color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-btn-disabled {
  padding: 0.375rem 0.75rem;
  background-color: #e5e7eb;
  color: #9ca3af;
  border-radius: 0.375rem;
  font-size: 1.05rem;
  font-weight: 500;
  border: none;
  outline: none;
  cursor: not-allowed;
  opacity: 0.7;
}
.nav-btn-disabled:hover {
  background-color: #e5e7eb;
  transform: none;
  box-shadow: none;
}

/* 模式切换按钮特殊样式 */
.mode-toggle-btn-practice,
.mode-toggle-btn-memorize {
  background-color: #3b82f6;
  color: #ffffff;
}

.bottom-btn-group {
  display: flex;
  gap: 0.5rem;
  margin-right: 16px;
  align-items: center;
}

/* 4. 底部题号按钮（答题区下方） */
.group-question-btn {
  width: 2.0rem;
  height: 2.0rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.0rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}
.group-question-btn-normal {
  background-color: #e5e7eb;
  color: #3b82f6;
}
.group-question-btn-normal:hover, 
.group-question-btn-done-correct:hover,
.group-question-btn-done-incorrect:hover {
  background-color: #3b82f6;
  color: #fff;
}

/* 🔥 核心修复：当前题号优先级最高，无论对错都强制高亮 */
.group-question-btn-active {
  background-color: #3b82f6 !important;
  color: #ffffff !important;
  font-weight: bold !important;
}
.group-question-btn-active:hover {
  background-color: #059669 !important;
}

.group-question-btn-done-correct {
  background-color: #d1fae5;
  color: #065f46;
}
.group-question-btn-done-incorrect {
  background-color: #fee2e2;
  color: #991b1b;
}

/* 6. 确定按钮（多选题专用） */
.confirm-btn {
  padding: 0.375rem 0.75rem;
  background-color: #3b82f6;
  color: #ffffff;
  border-radius: 0.375rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.15rem;
  font-weight: 500;
  border: none;
  outline: none;
  cursor: pointer;
  margin-top: 0.5rem;
}
.confirm-btn:hover {
  background-color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}



/* ================================== 题目区域样式 ================================== */
/* 1. 题目文本容器 */
#question-text {
  text-align: left;
  width: 100%;
  max-width: none;
  margin: 0;
  display: block;
  line-height: 1.8;
  padding: 1rem 0;  
  color: #1f2937;
  font-size: 1.18rem !important;
}

/* 2. 选择题选项 */
.option-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background-color: #fff;
  transition: all 0.2s ease;
  cursor: pointer;
}
.option-item:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
}
.option-item-correct {
  background-color: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}
.option-item-incorrect {
  background-color: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.75rem;
  cursor: pointer;
  appearance: none;
}
.option-item input[type="radio"] {
  border-radius: 50%;
  border: 2px solid #9ca3af;
}
.option-item input[type="checkbox"] {
  border-radius: 0.25rem;
  border: 2px solid #9ca3af;
}
.option-item input[type="radio"]:checked,
.option-item input[type="checkbox"]:checked {
  border-color: #3b82f6;
  background-color: #3b82f6;
}
.option-item input[type="radio"]:checked {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
}
.option-item input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  font-weight: 600;
  margin-right: 0.75rem;
  font-size: 1.15rem; 
}
.option-letter-correct {
  background-color: #10b981;
  color: #ffffff;
}
.option-letter-incorrect {
  background-color: #ef4444;
  color: #ffffff;
}

.option-content {
  flex: 1;  
  color: #1f2937;
  font-size: 1.15rem !important;
}

/* ================================== 布局容器样式 ================================== */
.group-question-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.5rem 0;
  justify-content: flex-start;
  align-content: flex-start;
}

header .container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;  
  align-items: center;
}

/* 第二层按钮容器 gap（核心生效位置） */
#main-header .container > div > div {
  gap: 0.5rem !important;  
  margin: 0 !important;
}

#main-content {
  height: calc(100vh - 100px);
}

#group-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  overflow-y: auto;
}

#answer-feedback {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 0.5rem;
  font-size: 1.15rem !important;
}

#answer-feedback,
#answer-feedback p,
#answer-feedback div {
  font-size: 1.15rem !important;
  line-height: 1.6 !important;
}
/* ================================== 全局样式优化 ================================== */
button:focus {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

input:focus,
button:focus {
  outline: none !important;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-track {
  background-color: #f8fafc;
}