﻿:root {
  color-scheme: light;
  --bg-page: #f5f7fb;
  --bg-card: #ffffff;
  --bg-hero: linear-gradient(135deg, #edf2ff 0%, #e0f2fe 100%);
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.12);
  --primary-text: #1d4ed8;
  --accent: #38bdf8;
  --text-main: #0f172a;
  --text-soft: #64748b;
  --border: rgba(148, 163, 184, 0.35);
  --shadow-sm: 0 10px 25px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 18px 36px rgba(15, 23, 42, 0.1);
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.layout main {
  flex: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.nav-links a {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  color: #1f2937;
  transition: all 0.2s ease;
}

.nav-links a:hover {
  background: rgba(37, 99, 235, 0.08);
  text-decoration: none;
}

.nav-links a[aria-current="page"] {
  background: var(--primary);
  color: #fff;
}

/* Avatar in topbar */
.nav-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(148, 163, 184, 0.35);
  background: #e2e8f0;
  cursor: pointer;
}

.nav-avatar.mobile-nav-avatar {
  display: none;
}

.nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 下拉导航 */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  color: #1f2937;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
}

.nav-dropdown-toggle::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.6;
  transition: transform 0.2s ease;
}

.nav-dropdown:hover .nav-dropdown-toggle::after {
  transform: rotate(180deg);
}

.nav-dropdown-toggle:hover {
  background: rgba(37, 99, 235, 0.08);
  text-decoration: none;
}

.nav-dropdown-toggle[aria-current="page"] {
  background: var(--primary);
  color: #fff;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  min-width: 160px;
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 100;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.nav-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-item {
  display: block;
  padding: 0.6rem 1.2rem;
  color: #1f2937;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.nav-dropdown-item:hover {
  background: rgba(37, 99, 235, 0.06);
  text-decoration: none;
}

.nav-dropdown-item[aria-current="page"] {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-text);
  font-weight: 600;
}

main {
  width: min(1140px, 92vw);
  margin: 0 auto;
  padding: 2.5rem 0 3.5rem;
  display: grid;
  gap: 2.5rem;
}

.hero {
  background: var(--bg-hero);
  border-radius: 28px;
  padding: 2.75rem clamp(1.5rem, 5vw, 3rem);
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: center;
  box-shadow: var(--shadow-md);
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.2rem, 4vw, 3.1rem);
}

.hero p {
  margin: 0;
  color: #1e293b;
  line-height: 1.7;
}

.hero-actions {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-illustration {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hero-illustration .card-chip {
  padding: 0.9rem 1.4rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  text-align: center;
  color: var(--primary);
  white-space: nowrap;
}

.section-title {
  margin: 0;
  font-size: 1.6rem;
}

.feature-grid {
  display: grid;
  gap: 1.6rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

@media (max-width: 768px) {
  /* Hero区域移动端优化 */
  .hero {
    padding: 2rem 1.5rem;
  }
  
  .hero-illustration {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .hero-illustration .card-chip {
    padding: 0.8rem 1.2rem;
    font-size: 15px;
    flex: 1 1 0;
    min-width: 0;
  }
  
  /* 功能卡片网格 */
  .feature-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  /* 按钮在手机端优化 */
  .btn {
    padding: 0.7rem 1.2rem;
    font-size: 15px;
  }
  
  /* 标题字号调整 */
  h1 {
    font-size: 1.8rem !important;
  }
  
  h2 {
    font-size: 1.4rem !important;
  }
  
  /* 间距优化 */
  main {
    padding: 1.5rem 0 2rem;
  }
  
  /* 表单字段优化 */
  .field input,
  .field select,
  .field textarea {
    font-size: 16px; /* 防止iOS自动缩放 */
    padding: 12px 14px;
  }
  
  /* 考试题目选项优化 */
  .option-item {
    padding: 12px 14px;
    min-height: 48px; /* 确保触摸区域足够大 */
  }
  
  .option-label {
    min-width: 32px;
    height: 32px;
    font-size: 15px;
  }
  
  .option-text {
    font-size: 15px;
    line-height: 1.5;
  }
  
  /* 考试页面优化 */
  .exam-question {
    padding: 1.2rem;
  }
  
  .question-stem {
    font-size: 15px;
    line-height: 1.6;
  }
  
  /* 统计数据卡片优化 */
  .stat-item {
    padding: 10px 16px;
  }
  
  .stat-value {
    font-size: 20px;
  }
  
  /* 题库列表优化 */
  .bank-list-item {
    padding: 1rem;
  }
  
  /* 搜索框优化 */
  input[type="text"],
  input[type="search"] {
    font-size: 16px; /* 防止iOS缩放 */
  }
}

.card {
  background: var(--bg-card);
  border-radius: 22px;
  padding: clamp(1.5rem, 4vw, 2.2rem);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 1rem;
}

.card header h2,
.card h1,
.card h2,
.card h3 {
  margin: 0;
}

.card p {
  margin: 0;
  color: var(--text-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.secondary {
  background: #e0ecff;
  color: var(--primary-text);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(37, 99, 235, 0.25);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  z-index: 1000;
}

.modal {
  width: min(640px, 92vw);
  max-height: 82vh;
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 1rem 1.2rem;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.9rem;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  z-index: 1;
}

.modal .form-grid {
  overflow: auto;
  overscroll-behavior: contain;
}

.footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-soft);
}

/* BANKS PAGE */

.workspace-shell {
  display: grid;
  gap: 2rem;
}

@media (max-width: 768px) {
  .workspace-shell {
    gap: 1rem;
  }
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  height: 180px; /* 固定高度，内部滚动 */
  overflow: auto;
  background: #fff;
}

.list li {
  padding: 0.95rem 1.2rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  cursor: pointer;
  transition: background 0.2s ease;
}

.list li small {
  display: block;
  color: var(--text-soft);
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
  line-height: 1.6;
}

.list li.active small,
.list li.active strong {
  color: #fff;
}

.list li:last-child {
  border-bottom: none;
}

.list li:hover {
  background: rgba(37, 99, 235, 0.08);
}

.list li.active {
  background: var(--primary);
  color: #fff;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

/* Banks page: grouped question list */
.question-group {
  display: grid;
  gap: 0.6rem;
}

.question-list {
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.question-row {
  display: grid;
  grid-template-columns: 1fr 120px 1fr 190px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(226, 232, 240, 0.7);
}

@media (max-width: 768px) {
  .question-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
  }
  .question-row .col.actions {
    justify-content: flex-start;
  }
}

.question-row.head {
  background: rgba(248, 250, 252, 0.8);
  font-weight: 700;
  border-top: none;
}

.question-row .col.text {
  min-width: 0;
}

.question-row .col.answer {
  color: var(--text-soft);
}

.question-row .col.actions {
  display: flex;
  justify-content: flex-end;
  white-space: nowrap;
}

.question-row .col.actions .actions {
  flex-wrap: nowrap;
}

/* Highlight newly focused form after edit click */
#question-form.highlight {
  box-shadow: 0 0 0 3px var(--primary-soft);
  border-radius: 14px;
}

/* Question type filter bar */
.question-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.question-filter .btn {
  padding: 0.45rem 1rem;
}

.question-filter .btn.active {
  background: var(--primary);
  color: #fff;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.95rem;
}

input[type="text"],
input[type="number"],
input[type="search"],
textarea,
select {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input[type="radio"]:focus,
input[type="checkbox"]:focus {
  outline: none;
  box-shadow: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
  width: 1rem;
  height: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-text);
  font-size: 0.8rem;
  font-weight: 600;
}

.tag-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.empty {
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  color: var(--text-soft);
}

.empty.large {
  padding: 2.5rem;
  font-size: 1.02rem;
}

/* EXAM CONFIG */

.config-shell {
  width: min(1200px, 94vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
}

.config-sidebar {
  display: grid;
  gap: 1.5rem;
  align-content: start;
}

.bank-list {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 0.8rem;
}

.bank-list-item {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.35rem;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
}

.bank-list-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.bank-list-item header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.config-main {
  display: grid;
  gap: 1.5rem;
}

.config-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.search-bar {
  position: relative;
  width: clamp(220px, 30vw, 320px);
}
.search-bar.small {
  width: clamp(260px, 36vw, 460px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.search-bar.small::after {
  content: none;
}

.search-bar.small input {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 0.85rem; /* 移除为放大镜预留的额外内边距 */
}

.search-bar.small .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.question-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.search-bar input {
  width: 100%;
}

.config-panel {
  background: var(--bg-card);
  border-radius: 22px;
  padding: 1.8rem clamp(1.2rem, 3vw, 2.2rem);
  box-shadow: var(--shadow-sm);
  min-height: 320px;
  display: grid;
  gap: 1.4rem;
}

.range-row {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

/* Exam-config: per-type row keeps in one line on wide screens */
.type-advanced {
  display: grid;
  gap: 1rem;
}

.type-row {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 120px minmax(260px, 1fr) 220px max-content;
  align-items: center;
}

.type-row label.checkbox {
  align-self: center;
}

.type-row label:not(.checkbox) {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.6rem;
}

.type-row label:not(.checkbox) > input {
  width: 100%;
}

.type-row .range-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* Mode switch for manual vs byType */
.mode-switch {
  display: flex;
  gap: 1.5rem;
  padding: 1rem;
  background: rgba(37, 99, 235, 0.06);
  border-radius: 14px;
  border: 1px solid var(--border);
}

.mode-switch label.checkbox {
  font-weight: 600;
}

.range-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.question-checklist {
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 18px;
  max-height: 360px;
  overflow: auto;
  padding: 1rem;
  display: grid;
  gap: 0.6rem;
}

.question-item {
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.6);
  border: 1px solid transparent;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.question-item .question-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.question-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 600;
}


.question-item.no-checkbox {
  padding-left: 0.85rem;
}

.question-item.no-checkbox .question-index {
  margin-left: 0;
}

.question-item.active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 2px var(--primary-soft);
  background: rgba(37, 99, 235, 0.05);
}

.question-index {
  font-weight: 700;
  color: var(--primary-text);
  width: 2.5rem;
}

.loading {
  text-align: center;
  color: var(--text-soft);
}

/* EXAM SESSION */

.exam-session-page {
  width: min(760px, 94vw);
  margin: 0 auto;
  display: grid;
  gap: 2rem;
}

.exam-session-card {
  background: var(--bg-card);
  border-radius: 22px;
  padding: clamp(1.6rem, 3vw, 2.2rem);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 1.5rem;
}

.exam-question {
  padding: 1.4rem 1.6rem;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(248, 250, 252, 0.9);
  display: grid;
  gap: 1rem;
}

.exam-question.correct {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}

.exam-question.incorrect {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

.question-title {
  margin: 0;
  font-size: 1.05rem;
}

.question-content {
  display: grid;
  gap: 0.7rem;
}

.option-list {
  display: grid;
  gap: 0.55rem;
}

.result-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.2rem;
  border-radius: 18px;
  background: rgba(224, 242, 254, 0.75);
  color: #0f172a;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.submit-block {
  margin-top: 1.2rem;
  display: flex;
  justify-content: flex-end;
}

/* RESPONSIVE */

@media (max-width: 960px) {
  main {
    width: min(95vw, 720px);
  }

  .config-shell {
    grid-template-columns: 1fr;
  }

  .exam-session-page,
  .exam-session-card {
    width: min(95vw, 680px);
  }

  /* No fixed heights on small screens */
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .hero {
    padding: 2.2rem 1.4rem;
  }

  .hero-actions {
    justify-content: center;
  }

  .result-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .submit-block {
    justify-content: center;
  }
}

/* exam-config mobile overflow fixes */
@media (max-width: 768px) {
  .config-toolbar {
    flex-wrap: wrap;
    gap: 0.6rem;
  }
  .search-bar,
  .search-bar.small {
    width: 100% !important;
  }
  .search-bar input {
    width: 100% !important;
  }
  .range-row.type-row,
  .type-row {
    grid-template-columns: 1fr !important;
  }
  #question-search-input {
    width: 100% !important;
  }
  .question-text {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
}

/* Change Password Modal UI enhancements */
.pwd-modal {
  max-width: 520px;
}
.pwd-modal .modal-header {
  padding: 0.4rem 0 0.6rem;
  border-bottom: 1px dashed var(--border);
}
.pwd-modal .modal-close {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: #64748b;
}
.pwd-modal .verify-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.pwd-modal .input-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 8px;
}
.pwd-modal .code-row {
  display: grid;
  grid-template-columns: 1fr max-content;
  gap: 8px;
  align-items: center;
}
.pwd-modal .hint {
  color: #64748b;
}

/* 验证码输入与按钮样式优化 */
.pwd-modal .code-row .btn {
  height: 42px;
  border-radius: 12px;
  padding: 0 14px;
  white-space: nowrap;
}

/* Unified input aesthetics in modal */
.pwd-modal input[type="password"],
.pwd-modal input[type="text"],
.pwd-modal input[type="number"] {
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.pwd-modal input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* 验证码输入特殊优化：等宽数字、居中对齐、字母间距 */
.pwd-modal .code-input {
  letter-spacing: 4px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

@media (max-width: 640px) {
  .pwd-modal {
    max-width: 92vw;
  }
  .pwd-modal .input-row { grid-template-columns: 1fr; }
}

/* 更小屏手机优化 */
@media (max-width: 480px) {
  .pwd-modal .verify-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .pwd-modal .code-row {
    grid-template-columns: 1fr;
  }
  .pwd-modal .code-row .btn {
    width: 100%;
  }
  .pwd-modal .actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .pwd-modal .actions .btn {
    width: 100%;
    min-height: 44px;
  }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.bank-list-grid {
  display: grid;
  gap: 0.75rem;
  max-height: 420px;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}


.question-stack {
  display: grid;
  gap: 1.4rem;
}


.bank-layout {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: stretch;
}

.bank-layout > article.card {
  height: 100%;
}


.question-item.highlight {
  box-shadow: 0 0 0 3px var(--primary-soft);
}


.question-item {
  cursor: pointer;
}

.question-item input[type="checkbox"] {
  margin-top: 0.35rem;
}


/* 移动端汉堡菜单和侧边栏 */
.menu-toggle {
  display: none;
}

.mobile-sidebar {
  display: none;
}

.sidebar-overlay {
  display: none;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
  }
  
  .menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: #1f2937;
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 1px;
  }
  
  .menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }
  
  .mobile-sidebar {
    display: block;
    position: fixed;
    top: 56px;
    left: -280px;
    width: 280px;
    height: calc(100vh - 56px);
    background: #fff;
    box-shadow: none;
    border-right: 1px solid #e2e8f0;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }
  
  .mobile-sidebar.active {
    left: 0;
  }
  
  .mobile-sidebar-header {
    display: none;
  }
  
  .mobile-sidebar-close {
    display: none;
  }
  
  .mobile-sidebar-nav {
    padding: 8px 12px;
  }
  
  .mobile-sidebar-nav > a,
  .mobile-sidebar-nav > .mobile-nav-group {
    margin-bottom: 4px;
  }
  
  /* 一级导航（无子菜单的）：大字体 */
  .mobile-sidebar-nav > a {
    display: block;
    padding: 14px 16px;
    color: #1f2937;
    text-decoration: none;
    border-radius: 10px;
    transition: background 0.2s;
    font-size: 16px;
    font-weight: 600;
  }
  
  .mobile-sidebar-nav > a:hover {
    background: #f8fafc;
  }
  
  .mobile-sidebar-nav > a[aria-current="page"] {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
  }
  
  /* 移动端二级导航组 */
  .mobile-nav-group {
    margin-bottom: 4px;
  }
  
  /* 一级导航（有子菜单的标题）：大字体 */
  .mobile-nav-parent {
    padding: 14px 16px;
    color: #1f2937;
    font-size: 16px;
    font-weight: 600;
  }
  
  /* 二级导航：小字体 */
  .mobile-nav-child {
    display: block;
    padding: 8px 16px 8px 32px;
    color: #1f2937;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 13px;
    font-weight: 400;
    border-radius: 10px;
    position: relative;
    margin-bottom: 0;
  }
  
  .mobile-nav-child::before {
    content: '—';
    position: absolute;
    left: 16px;
    opacity: 0.3;
    font-size: 12px;
  }
  
  .mobile-nav-child:hover {
    background: #f8fafc;
  }
  
  .mobile-nav-child[aria-current="page"] {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
  }
  
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  
  .sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  
  .topbar {
    padding: 0 12px !important;
    height: 56px !important;
    min-height: 56px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    position: relative !important;
  }

  .menu-toggle {
    order: 0 !important;
    margin-right: 12px !important;
  }

  .topbar .brand {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin: 0 !important;
    font-size: 16px !important;
    text-align: center !important;
    padding: 0 !important;
  }

  .nav-avatar.mobile-nav-avatar {
    display: inline-flex;
    margin-left: auto;
  }
  
  .topbar .nav-links {
    display: none !important;
  }
}

/* MOBILE: prevent horizontal scrolling and scale media within viewport */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    max-width: 100%;
  }
  img, video, canvas, svg {
    max-width: 100%;
    height: auto;
  }
}
