/* ====== 基础 ====== */
:root {
  --bg: #f8f9fa;
  --card-bg: #fff;
  --shadow: 0 8px 24px rgba(0, 0, 0, .06);
  --text: #212529;
  --muted: #6c757d;
  --primary: #0d6efd;
  --success: #28a745;
  --danger: #dc3545;
  --secondary: #6c757d;
  --ring: rgba(13, 110, 253, .35);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', '微软雅黑', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====== 卡片与标题 ====== */
.quiz-card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-top: 44px;
}

.word-title {
  font-size: clamp(1.5rem, 2.2vw + 1rem, 2rem);
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1.2;
}

.sub {
  color: var(--muted);
}

/* ====== 选项按钮 ====== */
.opt-btn {
  text-align: left;
  width: 100%;
  margin-bottom: 12px;
  border-radius: 12px;
  transition: box-shadow .15s ease, transform .05s ease;
}

.opt-btn:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, .06);
}

.opt-btn:active {
  transform: translateY(1px);
}

.opt-btn.active {
  outline: 2px solid var(--primary);
}

/* ====== 顶部控制面板 ====== */
.panel {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel .form-check {
  margin-right: 10px;
}

/* ====== 弹窗答题卡网格 ====== */
.answer-sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 10px;
}

.answer-btn-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease, opacity .2s;
  user-select: none;
}

.answer-btn-circle:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .12);
}

.answer-btn-circle:active {
  transform: translateY(0);
}

.answer-btn-circle.state-correct {
  background: var(--success);
}

.answer-btn-circle.state-wrong {
  background: var(--danger);
}

.answer-btn-circle.state-pending {
  background: var(--secondary);
}

.answer-btn-circle.state-current {
  box-shadow: 0 0 0 3px var(--ring);
}

.answer-btn-circle:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--ring), 0 8px 20px rgba(13, 110, 253, .12);
}

/* 颜色说明小圆点 */
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

/* ====== 搜索条 ====== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto 16px auto;
  padding: 0;
}

.search-input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #c8d2e2;
  border-radius: 999px;
  background: #f2f4f7;
  font-size: 16px;
  color: #6c757d;
  outline: none;
  transition: all 0.3s ease;
}

.search-input::placeholder {
  color: #b1bac3;
}

.search-input:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.35);
}

.search-btn {
  height: 40px;
  min-width: 60px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid #c8d2e2;
  background: #0d6efd;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  transition: background 0.3s ease;
}

.search-btn:hover {
  background: #0b5ed7;
}

.search-btn:active {
  background: #0a4a94;
}

/* 搜索按钮里的放大镜图标 */
.search-btn .icon-search {
  width: 18px;
  height: 18px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230d6efd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

/* 搜索框和返回按钮布局 */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.search-input {
  flex-grow: 1;
  padding: 8px 16px;
  border-radius: 25px;
  border: 1px solid #ced4da;
  font-size: 16px;
  transition: all 0.3s ease;
}

.search-btn {
  background-color: #0d6efd;
  color: white;
  padding: 8px 16px;
  border-radius: 25px;
  border: none;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-btn:hover {
  background-color: #0b5ed7;
}

.return-btn {
  padding: 8px 16px;
  background: #f8f9fa;
  color: #0d6efd;
  border-radius: 25px;
  font-size: 16px;
  font-weight: bold;
  text-decoration: none;
  border: 2px solid #0d6efd;
  transition: all 0.3s ease;
}

.return-btn:hover {
  background: #0d6efd;
  color: white;
  border-color: #0b5ed7;
}

.return-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.35);
}

/* ====== 登录页背景与卡片 ====== */
body.login-page {
  min-height: 100vh;
  background: url("../img/login-bg.jpg") center/cover no-repeat fixed;
}

.login-card {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: .75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}

/* ====== 可访问性与细节 ====== */
:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--ring);
}

button:disabled,
.disabled {
  cursor: not-allowed;
  opacity: .65;
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* 微调样式 */
@media (max-width: 576px) {
  .quiz-card {
    padding: 20px;
    margin-top: 28px;
  }

  .answer-sheet-grid {
    gap: 8px;
  }

  .answer-btn-circle {
    width: 38px;
    height: 38px;
    font-size: .95rem;
  }
}


/* ====== 搜索条（紧凑版）====== */
.search-bar{
  display:flex;
  align-items:center;
  gap:8px;
  max-width:560px;
  margin: 6px auto 8px;    /* 上下更窄，避免挤压下面文字 */
  padding:0;
}

.search-input{
  flex:1;
  height:34px;             /* 由 40px 降到 34px */
  padding:0 12px;          /* 垂直 0，更紧凑 */
  border:1px solid #c8d2e2;
  border-radius:22px;      /* 更扁的胶囊 */
  background:#f2f4f7;
  font-size:15px;
  color:#6c757d;
  outline:none;
  transition:all .2s ease;
}
.search-input::placeholder{ color:#b1bac3; }
.search-input:focus{
  border-color:#0d6efd;
  box-shadow:0 0 0 3px rgba(13,110,253,.35);
}

.search-btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  height:34px;             /* 由 40px 降到 34px */
  min-width:56px;
  padding:0 12px;          /* 垂直 0 */
  border-radius:22px;
  border:none;
  background:#0d6efd;
  color:#fff;
  font-weight:600;
  cursor:pointer;
  transition:transform .06s ease, background .2s ease, box-shadow .2s ease;
}
.search-btn:hover{ background:#0b5ed7; box-shadow:0 4px 12px rgba(13,110,253,.25); }
.search-btn:active{ transform:translateY(1px); }

/* 放大镜更突出（白色、变大、带轻微发光） */
.search-btn .icon-search{
  width:20px;              /* 18 -> 20 更醒目 */
  height:20px;
  flex:0 0 20px;
  background:no-repeat center/contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.25));
}

/* 小屏再紧一点 */
@media (max-width:576px){
  .search-bar{ margin:4px auto 6px; }
  .search-input, .search-btn{ height:32px; border-radius:20px; }
  .search-btn .icon-search{ width:18px; height:18px; }
}
/* —— 统一告警样式（无需 Bootstrap） —— */
.alert{
  display:block;
  width:100%;
  padding:.75rem 1rem;
  margin: .75rem 0 0 0;           /* 等价 mt-3 */
  border:1px solid transparent;
  border-radius:.5rem;
  box-sizing:border-box;
  word-break:break-word;
}
.alert-danger{
  background:#f8d7da;
  border-color:#f5c2c7;
  color:#842029;
}
.alert-success{
  background:#d1e7dd;
  border-color:#badbcc;
  color:#0f5132;
}

/* 避免卡片把内部圆角/阴影裁掉 */
.quiz-card{ overflow: visible; }

/* 若父级用了 display:flex 且有挤压，强制占满行 */
#judgeAlert{ flex: 0 0 100%; }
