:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --line: #d9e2ec;
  --text: #172033;
  --muted: #667085;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --blue: #2563eb;
  --orange: #f97316;
  --danger: #dc2626;
  --ok: #16a34a;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

h3 {
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

.hidden {
  display: none !important;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mobile-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 14px 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.compact-panel {
  padding: 13px 14px;
}

.step-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.step-strip span {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.step-strip span.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.step-strip span.done {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.profile-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.primary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  min-height: 40px;
  border-radius: 8px;
  padding: 9px 13px;
  font-weight: 700;
  white-space: nowrap;
}

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

.primary-btn:hover {
  background: var(--primary-strong);
}

.ghost-btn,
.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

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

.full {
  width: 100%;
}

.message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  min-width: 240px;
  max-width: 85vw;
  background: rgba(23, 32, 51, 0.92);
  color: #ffffff;
  border: 0;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.message.ok {
  background: rgba(22, 163, 74, 0.95);
  color: #ffffff;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge.muted {
  background: var(--surface-2);
  color: var(--muted);
}

.badge.warn {
  background: #ffedd5;
  color: #c2410c;
}

.exam-list {
  display: grid;
  gap: 10px;
}

.exam-item,
.question-block,
.result-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 13px;
}

.exam-item {
  display: grid;
  gap: 8px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.question-list {
  display: grid;
  gap: 12px;
}

.exam-header {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.question-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.option-list {
  display: grid;
  gap: 8px;
}

.option-btn {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 9px;
  text-align: left;
}

.option-btn.selected {
  border-color: var(--primary);
  background: #ecfdf5;
}

.option-key {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}

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

.score-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.submit-bar {
  position: sticky;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 10px;
  margin-top: 14px;
}

.submit-bar strong,
.submit-bar span {
  display: block;
}

.submit-bar strong {
  font-size: 18px;
}

.submit-bar span {
  color: var(--muted);
  font-size: 12px;
}

.compact-actions {
  margin-top: 0;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  color: var(--text);
}

.admin-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}

.admin-main {
  padding: 22px;
  min-width: 0;
}

.empty-state {
  display: grid;
  gap: 8px;
  width: min(640px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.empty-state p {
  color: var(--muted);
}

.side-title {
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.side-list {
  display: grid;
  gap: 8px;
}

.side-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  text-align: left;
}

.side-item.active {
  border-color: var(--primary);
  background: #ecfdf5;
}

/* ── Tab 导航 ── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--line);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* ── 管理员主内容区两栏（设置/题目 Tab 内） ── */
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.editor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  margin-bottom: 14px;
}

/* ── 小按钮 ── */
.btn-sm {
  padding: 4px 10px !important;
  font-size: 12px !important;
  min-height: unset !important;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-weight: 800;
  background: var(--surface-2);
}

.stat-list {
  display: grid;
  gap: 8px;
}

.stat-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-size: 13px;
}

.upload-box {
  display: grid;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
}

.small-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .form-grid,
  .two-col,
  .score-board {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .profile-summary,
  .submit-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-actions,
  .compact-actions button {
    width: 100%;
  }

  .panel {
    padding: 14px;
  }

  .admin-main {
    padding: 14px;
  }
}

/* 倒计时悬浮条 */
.timer-banner {
  position: sticky;
  top: 10px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(254, 243, 199, 0.95);
  backdrop-filter: blur(4px);
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  color: #d97706;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  font-size: 14px;
}

.timer-banner strong {
  font-size: 16px;
  font-weight: 800;
}

.timer-banner.danger {
  background: #fee2e2; /* 紧急红 */
  border-color: #fca5a5;
  color: #dc2626;
}

/* 顶部 Banner 样式 */
.banner-container {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.08);
  margin-bottom: 16px;
  background: #fdf3f2;
}

.banner-img {
  width: 100%;
  height: auto;
  display: block;
}

/* 隐藏冗余的 topbar 文字标题 */
.topbar {
  display: none !important;
}

