body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f4f4;
  color: #333;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 20px auto;
  padding: 0 20px;
  flex: 1;
}

h1 {
  color: #0052cc;
  text-align: center;
  font-size: 2rem;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 15px;
  text-align: center;
}

h2, h3, h4 {
  color: #0052cc;
  text-align: center;
}

/* 登录/注册区域 */
.auth-toggle {
  text-align: center;
  margin: 20px auto;
}

.auth-toggle-btn {
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #0052cc;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.auth-toggle-btn:hover {
  background: #003d99;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.auth-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 20px auto;
  max-width: 400px;
  background-color: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Turnstile 容器样式 - 水平居中 */
.turnstile-container {
  display: flex;
  justify-content: center;
  margin: 15px 0;
  width: 100%;
}

.auth-hint {
  font-size: 0.9rem;
  color: #555;
  margin: 10px 0;
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 10px;
}

.auth-form input {
  padding: 10px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.auth-form input:focus {
  border-color: #0052cc;
  box-shadow: 0 0 5px rgba(0,82,204,0.3);
  outline: none;
}

.auth-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.auth-buttons button {
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #0052cc;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.auth-buttons button:hover {
  background: #003d99;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

/* 控制面板 */
.controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}

.controls select {
  padding: 10px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 100%;
  max-width: 300px; /* 更紧凑，与按钮宽度协调 */
  margin: 0 auto;
  box-sizing: border-box;
  text-align: center;
  text-align-last: center; /* 选项文字居中 */
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.controls select:focus {
  border-color: #0052cc;
  box-shadow: 0 0 5px rgba(0,82,204,0.3);
  outline: none;
}

/* 搜索区域 */
.search-container {
  display: flex;
  gap: 0;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

.search-container input {
  flex: 1;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-right: none;
  border-radius: 6px 0 0 6px;
  box-sizing: border-box;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.search-container input:focus {
  border-color: #0052cc;
  box-shadow: 0 0 5px rgba(0,82,204,0.3);
  outline: none;
}

.search-btn {
  padding: 10px 20px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-left: none;
  border-radius: 0 6px 6px 0;
  background: #0052cc;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-btn:hover {
  background: #003d99;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

/* 按钮组 */
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.control-btn {
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #0052cc;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.control-btn:hover {
  background: #003d99;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

/* 禁用按钮样式 */
.control-btn:disabled,
.prev-btn:disabled,
.next-btn:disabled,
.submit-btn:disabled {
  background: #cccccc;
  color: #666666;
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.control-btn:disabled:hover,
.prev-btn:disabled:hover,
.next-btn:disabled:hover,
.submit-btn:disabled:hover {
  background: #cccccc;
  box-shadow: none;
}

/* 小按钮样式 */
.small-btn {
  padding: 5px 10px;
  font-size: 0.9rem;
  min-width: auto;
  margin-right: 10px;
}

/* 按钮组样式 */
.button-group {
  display: flex;
  margin-top: 15px;
  gap: 10px;
}

/* 搜索结果中的按钮容器 */
#result div {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  align-items: center;
}

/* 黑暗模式按钮 */
#darkModeBtn {
  padding: 10px;
  min-width: 50px;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 用户信息容器 */
.user-info-container {
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin: 20px auto;
  max-width: 400px;
  text-align: left;
}

.user-info h3 {
  color: #0052cc;
  margin-top: 0;
  text-align: left;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.user-info p {
  margin: 8px 0;
  color: #333;
}

/* 黑暗模式下的用户信息样式 */
.dark-mode .user-info-container {
  background: #2a2a2a;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.dark-mode .user-info h3 {
  color: #80b3ff;
  border-bottom-color: #444;
}

.dark-mode .user-info p {
  color: #e0e0e0;
}

#darkModeBtn i {
  font-size: 1.2rem;
  color: white;
}

/* 题目和结果区域 */
.quiz, .result {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.question {
  margin-bottom: 20px;
}

.options label {
  display: block;
  margin: 10px 0;
  font-size: 1rem;
}

.options input {
  margin-right: 10px;
}

.timer {
  position: fixed;
  top: 20px;
  right: 20px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #de350b;
  font-family: monospace;
}

.prev-btn, .next-btn, .submit-btn {
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #0052cc;
  color: white;
  cursor: pointer;
  margin: 10px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.prev-btn:hover, .next-btn:hover, .submit-btn:hover {
  background: #003d99;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

#chartContainer {
  max-width: 500px;
  margin: 20px auto;
}

#annotations {
  margin-top: 20px;
  display: none;
}

.question-annotations {
  margin-top: 15px;
  padding: 15px;
  background-color: #f5f5f5;
  border-radius: 8px;
  display: none;
  width: 100%;
  box-sizing: border-box;
  clear: both;
  float: none;
  position: relative;
  z-index: 1;
}

.annotation-textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: vertical;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-size: 14px;
  box-sizing: border-box;
}

dark-mode .annotation-textarea {
  background-color: #444;
  color: #fff;
  border-color: #555;
}

.dark-mode .question-annotations {
  background-color: #333;
}

#annotations textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  resize: vertical;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

#annotations textarea:focus {
  border-color: #0052cc;
  box-shadow: 0 0 5px rgba(0,82,204,0.3);
  outline: none;
}

#annotations button {
  margin-top: 10px;
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #0052cc;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#annotations button:hover {
  background: #003d99;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

/* 页脚 */
footer {
  text-align: center;
  margin-top: 20px;
  padding: 10px 0;
  color: #666;
  width: 100%;
  background: #f8f9fa;
  box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
  font-size: 0.9rem;
}

footer a {
  color: #0052cc;
  text-decoration: none;
}

footer a:hover {
  color: #003d99;
  text-decoration: underline;
}

/* 黑暗模式 */
.dark-mode {
  background: #1a1a1a;
  color: #e0e0e0;
}

.dark-mode .auth-container {
  background-color: #2a2a2a !important;
}

/* 错误提示框样式 */
.error-modal {
  display: none; /* 默认隐藏 */
  position: fixed; /* 固定定位 */
  z-index: 1000; /* 确保在最上层 */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4); /* 半透明黑色背景 */
  animation: fadeIn 0.3s;
}

.error-modal-content {
  background-color: #fefefe;
  margin: 15% auto;
  padding: 20px;
  border-radius: 8px;
  width: 80%;
  max-width: 400px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  animation: slideIn 0.3s;
  text-align: center;
}

.error-modal-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.error-modal-close:hover {
  color: #333;
}

.error-modal-icon {
  font-size: 3rem;
  color: #de350b;
  margin-bottom: 15px;
}

.error-modal-title {
  color: #333;
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.error-modal-message {
  color: #555;
  margin-bottom: 20px;
  font-size: 1rem;
  line-height: 1.5;
}

.error-modal-button {
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #0052cc;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.error-modal-button:hover {
  background: #003d99;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

/* 黑暗模式下的错误提示框样式 */
.dark-mode .error-modal-content {
  background-color: #2a2a2a;
}

.dark-mode .error-modal-title {
  color: #e0e0e0;
}

.dark-mode .error-modal-message {
  color: #b0b0b0;
}

.dark-mode .error-modal-close {
  color: #777;
}

.dark-mode .error-modal-close:hover {
  color: #e0e0e0;
}

/* 动画效果 */
@keyframes fadeIn {
  from {opacity: 0;}
  to {opacity: 1;}
}

@keyframes slideIn {
  from {transform: translateY(-50px); opacity: 0;}
  to {transform: translateY(0); opacity: 1;}
}

.dark-mode .auth-container input {
  color: #e0e0e0 !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;
  border: 1px solid #333 !important;
}

.dark-mode .auth-hint {
  color: #aaa !important;
}

.dark-mode .auth-form {
  background-color: #2a2a2a !important;
}

.dark-mode .auth-form input[type="text"],
.dark-mode .auth-form input[type="password"],
.dark-mode .search-container input {
  background-color: #333 !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

.dark-mode .auth-form input:focus {
  border-color: #80b3ff !important;
  box-shadow: 0 0 5px rgba(128,179,255,0.3) !important;
}

.dark-mode .auth-buttons button {
  background-color: #0052cc !important;
  color: white !important;
  border-color: #0040a0 !important;
}

.dark-mode .auth-toggle-btn {
  background-color: #0052cc !important;
  color: white !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
}

.dark-mode h1, .dark-mode h2, .dark-mode h3, .dark-mode h4 {
  color: #80b3ff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.dark-mode .quiz, .dark-mode .result {
  background: #2a2a2a;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.dark-mode .auth-buttons button,
.dark-mode .control-btn,
.dark-mode .prev-btn,
.dark-mode .next-btn,
.dark-mode .submit-btn,
.dark-mode .search-btn,
.dark-mode #annotations button,
.dark-mode #darkModeBtn {
  background: #0052cc;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.dark-mode .auth-buttons button:hover,
.dark-mode .control-btn:hover,
.dark-mode .prev-btn:hover,
.dark-mode .next-btn:hover,
.dark-mode .submit-btn:hover,
.dark-mode .search-btn:hover,
.dark-mode #annotations button:hover,
.dark-mode #darkModeBtn:hover {
  background: #003d99;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

.dark-mode #darkModeBtn i {
  color: #e0e0e0;
}

.dark-mode input,
.dark-mode select,
.dark-mode textarea {
  background: #333;
  color: #e0e0e0;
  border: 1px solid #666;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.dark-mode input:focus,
.dark-mode select:focus,
.dark-mode textarea:focus {
  border-color: #80b3ff;
  box-shadow: 0 0 5px rgba(128,179,255,0.3);
}

.dark-mode .auth-hint {
  color: #aaa;
}

.dark-mode .timer {
  color: #ff4d4d;
}

.dark-mode footer {
  color: #aaa;
  background: #2a2a2a;
  box-shadow: 0 -1px 3px rgba(0,0,0,0.3);
}

.dark-mode footer a {
  color: #0052cc;
}

.dark-mode footer a:hover {
  color: #003d99;
}

:root {
  --success: #28a745;
  --danger: #de350b;
}

/* 移动端自适应 */
@media (max-width: 600px) {
  .container {
    padding: 0 8px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .auth-container {
    max-width: 100%;
    padding: 0 8px;
  }

  .auth-form input {
    font-size: 0.85rem;
    padding: 8px;
  }

  .auth-buttons button {
    padding: 8px 16px;
    font-size: 0.85rem;
    min-width: 100px;
  }

  .controls select {
    font-size: 0.85rem;
    padding: 8px;
    max-width: 100%;
    width: 100%;
    text-align: center;
    text-align-last: center;
  }

  .search-container {
    flex-direction: row;
    max-width: 100%;
    width: 100%;
  }

  .search-container input {
    font-size: 0.85rem;
    padding: 8px;
  }

  .search-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  .buttons {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .control-btn {
    width: 100%;
    max-width: 300px;
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  #darkModeBtn {
    min-width: 100px;
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  #darkModeBtn i {
    font-size: 1rem;
  }

  .prev-btn, .next-btn, .submit-btn {
    width: 100%;
    max-width: 300px;
    padding: 8px 16px;
    font-size: 0.85rem;
    margin: 5px auto;
  }

  .quiz, .result {
    padding: 15px;
  }

  .timer {
    top: 8px;
    right: 8px;
    font-size: 0.9rem;
  }

  #chartContainer {
    margin: 5px auto;
    max-width: 100%;
  }

  #annotations textarea {
    font-size: 0.85rem;
    padding: 8px;
  }

  #annotations button {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  footer {
    padding: 8px 0;
    font-size: 0.85rem;
  }
}