/* ===== 设计令牌 ===== */
:root {
  --blue: #0a59f7;
  --blue-dark: #0846c9;
  --blue-soft: #eef4ff;
  --blue-line: #c9dcff;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #8c98ab;
  --line: #e4e9f2;
  --bg: #f4f6fb;
  --white: #fff;
  --green: #12a150;
  --amber: #e08c00;
  --red: #e5484d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -12px rgba(16, 24, 40, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  font-size: 15px;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a {
  color: var(--blue);
  text-decoration: none;
}

/* ===== 通用控件 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.06s;
}

.btn:hover {
  background: var(--blue-dark);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.ghost {
  background: #fff;
  color: var(--ink-2);
  border-color: var(--line);
}

.btn.ghost:hover {
  background: #f8fafc;
  color: var(--ink);
}

.btn.sm {
  height: 34px;
  padding: 0 14px;
  font-size: 13.5px;
  border-radius: 8px;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field > .label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 7px;
}

.field > .label .req {
  color: var(--red);
  margin-left: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.textarea {
  height: auto;
  min-height: 92px;
  padding: 11px 13px;
  resize: vertical;
  line-height: 1.6;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(10, 89, 247, 0.14);
}

.input::placeholder,
.textarea::placeholder {
  color: #b6bfcd;
}

.input.invalid {
  border-color: var(--red);
  background: #fff8f8;
}

.hint {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 6px;
}

.err-text {
  font-size: 12.5px;
  color: var(--red);
  margin-top: 6px;
  display: none;
}

.err-text.show {
  display: block;
}

/* ===== 学生端 ===== */
.stu-wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 36px 20px 90px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.4px;
  margin-bottom: 18px;
}

.brand .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(10, 89, 247, 0.12);
}

.stu-head h1 {
  font-size: 30px;
  line-height: 1.35;
  letter-spacing: -0.5px;
  margin: 0 0 10px;
  font-weight: 700;
}

.stu-head p {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 14.5px;
  max-width: 720px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.chip {
  font-size: 12.5px;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 12px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
}

.card + .card {
  margin-top: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.step-no {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.card-head h2 {
  font-size: 17px;
  margin: 0;
  font-weight: 600;
}

.card-head .sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-left: 2px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

/* 进度条 */
.progress {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 246, 251, 0.92);
  backdrop-filter: blur(8px);
  padding: 12px 0 10px;
  margin-bottom: 4px;
}

.progress-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.bar {
  flex: 1;
  height: 6px;
  border-radius: 100px;
  background: #e2e8f3;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 100px;
  background: linear-gradient(90deg, #0a59f7, #4b8bff);
  transition: width 0.3s ease;
}

/* 题目 */
.q {
  padding: 20px 0;
  border-top: 1px solid #f0f3f8;
}

.q:first-child {
  border-top: none;
  padding-top: 4px;
}

.q-title {
  display: flex;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.55;
  margin-bottom: 4px;
}

.q-no {
  color: var(--blue);
  font-weight: 700;
  flex: none;
}

.q-desc {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 0 0 10px 0;
}

.q-desc.ml {
  margin-left: 34px;
}

.q.err .q-title {
  color: var(--red);
}

.opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.opt {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.14s, background 0.14s;
  font-size: 14.5px;
  line-height: 1.5;
}

.opt:hover {
  border-color: #c5d6f5;
  background: #fafcff;
}

.opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mark {
  width: 18px;
  height: 18px;
  flex: none;
  border: 1.5px solid #ccd4e0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: all 0.14s;
}

.opt.multi .mark {
  border-radius: 5px;
}

.mark::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
  transition: transform 0.14s;
}

.opt.multi .mark::after {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.opt:hover .mark {
  border-color: #a9bcd8;
}

.opt.on {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.opt.on .mark {
  border-color: var(--blue);
  background: var(--blue);
}

.opt.on .mark::after {
  transform: scale(1);
}

.opt .opt-txt {
  flex: 1;
}

.rank-badge {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.inline-extra {
  margin-top: 10px;
  display: none;
}

.inline-extra.show {
  display: block;
}

/* 矩阵题 */
.matrix {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.matrix-row {
  display: grid;
  grid-template-columns: 1.9fr repeat(3, minmax(72px, 0.7fr));
  align-items: stretch;
  border-top: 1px solid #eef1f7;
}

.matrix-row:first-child {
  border-top: none;
}

.matrix-row.head {
  background: #fafbfe;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}

.matrix-row.head > div {
  padding: 11px 12px;
  text-align: center;
}

.matrix-row.head > div:first-child {
  text-align: left;
}

.matrix-cell {
  padding: 11px 12px;
  font-size: 14px;
  color: var(--ink);
  display: flex;
  align-items: center;
  border-left: 1px solid #f2f5fa;
}

.matrix-opt {
  border-left: 1px solid #f2f5fa;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}

.matrix-opt:hover {
  background: #f7faff;
}

.matrix-opt input {
  position: absolute;
  opacity: 0;
}

.matrix-opt .mark {
  border-radius: 50%;
}

.matrix-opt.on {
  background: var(--blue-soft);
}

.matrix-opt.on .mark {
  border-color: var(--blue);
  background: var(--blue);
}

.matrix-opt.on .mark::after {
  transform: scale(1);
}

/* 提交区 */
.submit-bar {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.submit-bar .tip {
  font-size: 13px;
  color: var(--ink-3);
}

.wide {
  width: 100%;
}

/* 成功页 */
.done {
  text-align: center;
  padding: 54px 28px;
}

.done .circle {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: #e9f9f0;
  display: grid;
  place-items: center;
  animation: pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

@keyframes pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.done h2 {
  font-size: 22px;
  margin: 0 0 8px;
}

.done p {
  color: var(--ink-2);
  margin: 0 0 22px;
  font-size: 14.5px;
}

.done .summary {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: #fafbfe;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 13.5px;
  color: var(--ink-2);
  min-width: 280px;
}

.done .summary b {
  color: var(--ink);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 22px;
  transform: translate(-50%, -16px);
  background: #1d2939;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s;
  z-index: 999;
  max-width: 90vw;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== 管理端 ===== */
.admin-shell {
  min-height: 100vh;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 30px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 6px;
}

.login-card p {
  color: var(--ink-3);
  font-size: 13.5px;
  margin: 0 0 22px;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-in {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 15.5px;
}

.logo i {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, #0a59f7, #4c8dff);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.topbar .spacer {
  flex: 1;
}

.admin-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 24px 70px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.kpi .k-label {
  font-size: 12.5px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi .k-val {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-top: 4px;
  line-height: 1.2;
}

.kpi .k-val small {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  margin-left: 4px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.panel-head h3 {
  font-size: 15px;
  margin: 0;
  font-weight: 650;
}

.panel-head .note {
  font-size: 12.5px;
  color: var(--ink-3);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar .input,
.toolbar .select {
  height: 38px;
  width: auto;
  min-width: 140px;
  font-size: 14px;
}

/* 图表 */
.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-block {
  border: 1px solid #eef1f7;
  border-radius: 12px;
  padding: 16px 18px 10px;
  background: #fff;
}

.chart-title {
  font-size: 13.5px;
  font-weight: 650;
  margin: 0 0 3px;
}

.chart-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin: 0 0 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 8px;
  align-items: center;
  margin-bottom: 11px;
}

.bar-label {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bar-label span:last-child {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.bar-track {
  height: 8px;
  background: #eef2f8;
  border-radius: 100px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--blue);
  width: 0;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.bar-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
  align-self: end;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
}

.legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 5px;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 780px;
}

table.data th {
  position: sticky;
  top: 0;
  background: #fafbfe;
  text-align: left;
  font-weight: 600;
  color: var(--ink-2);
  font-size: 12.5px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid #f2f5fa;
  color: var(--ink-2);
  white-space: nowrap;
}

table.data tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

table.data tbody tr:hover {
  background: #f7faff;
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

td .nm {
  color: var(--ink);
  font-weight: 600;
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 100px;
  font-size: 12px;
  background: #eef2f8;
  color: var(--ink-2);
}

.pill.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--ink-3);
  font-size: 14px;
}

/* 抽屉 */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
  z-index: 90;
}

.drawer-mask.on {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 94vw);
  background: #fff;
  box-shadow: -16px 0 40px rgba(16, 24, 40, 0.14);
  transform: translateX(102%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.3, 1);
  z-index: 95;
  display: flex;
  flex-direction: column;
}

.drawer.on {
  transform: translateX(0);
}

.drawer-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.drawer-head h3 {
  font-size: 17px;
  margin: 0 0 3px;
}

.drawer-head .meta {
  font-size: 12.5px;
  color: var(--ink-3);
}

.drawer-body {
  padding: 18px 22px 40px;
  overflow-y: auto;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  background: #fafbfe;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.info-grid .k {
  font-size: 12px;
  color: var(--ink-3);
}

.info-grid .v {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}

.ans-item {
  padding: 13px 0;
  border-top: 1px solid #f0f3f8;
}

.ans-item:first-child {
  border-top: none;
}

.ans-q {
  font-size: 13.5px;
  color: var(--ink-2);
  margin-bottom: 5px;
  display: flex;
  gap: 6px;
}

.ans-q b {
  color: var(--blue);
  flex: none;
}

.ans-a {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  word-break: break-word;
}

.ans-a .sub {
  display: block;
  font-weight: 400;
  color: var(--ink-3);
  font-size: 13px;
  margin-top: 3px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  flex: none;
}

.icon-btn:hover {
  background: #f6f8fb;
  color: var(--ink);
}

.danger-link {
  color: var(--red);
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.danger-link:hover {
  text-decoration: underline;
}

.activity-head {
  align-items: center;
}

.activity-head h3 {
  margin-bottom: 3px;
}

.activity-create {
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-create .input {
  width: min(280px, 32vw);
}

.activity-list {
  border-top: 1px solid var(--line);
}

.qr-preview {
  padding: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  background: #fbfcff;
}

.qr-preview.hidden {
  display: none;
}

.qr-copy {
  min-width: 0;
}

.qr-copy > span,
.qr-copy > b {
  display: block;
}

.qr-copy > b {
  margin: 5px 0 3px;
  font-size: 15px;
  color: var(--ink);
}

.qr-copy > span:not(.note) {
  max-width: 440px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-3);
  font-size: 12px;
}

.qr-copy .activity-actions {
  margin-top: 13px;
}

.qr-preview img {
  width: 176px;
  height: 176px;
  flex: none;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.activity-row {
  min-height: 58px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #eef1f7;
}

.activity-row:last-child {
  border-bottom: none;
}

.activity-row.active {
  background: #f7faff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.activity-name {
  min-width: 0;
  flex: 1;
}

.activity-name b,
.activity-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-name b {
  font-size: 14px;
  color: var(--ink);
}

.activity-name span {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-3);
}

.activity-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.status-pill {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #eef2f6;
  color: #475467;
  white-space: nowrap;
}

.status-pill.published {
  background: #e7f7ee;
  color: #177245;
}

.status-pill.closed {
  background: #fbecec;
  color: #b42318;
}

@media (max-width: 860px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .charts {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .stu-wrap {
    padding-top: 24px;
  }
  .stu-head h1 {
    font-size: 24px;
  }
  .card {
    padding: 20px 18px;
  }
  .matrix-row {
    grid-template-columns: 1.4fr repeat(3, minmax(52px, 0.6fr));
  }
  .matrix-cell,
  .matrix-row.head > div {
    padding: 9px 8px;
    font-size: 13px;
  }
  .activity-head {
    align-items: stretch;
  }
  .activity-create {
    width: 100%;
  }
  .activity-create .input {
    width: auto;
    flex: 1;
  }
  .activity-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .qr-preview {
    align-items: flex-start;
  }
  .qr-preview img {
    width: 132px;
    height: 132px;
  }
  .activity-actions {
    width: 100%;
  }
}
