/* ==========================================================
   XSCTF WP 收集平台 — 设计系统
   对齐 GZCTF v1.9 (Mantine v7)：primary #228be6 / radius .5rem / 亮暗双主题
   ========================================================== */

:root {
  --primary: #228be6;
  --primary-600: #1c7ed6;
  --primary-700: #1864ab;
  --primary-soft: #e7f5ff;

  --green: #40c057;
  --green-soft: #ebfbee;
  --orange: #fd7e14;
  --orange-soft: #fff4e6;
  --red: #fa5252;
  --red-soft: #fff5f5;
  --violet: #7950f2;
  --violet-soft: #f3f0ff;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "JetBrains Mono",
    "Liberation Mono", monospace;

  --bg: #ffffff;
  --bg-soft: #f8f9fa;
  --bg-sunken: #f1f3f5;
  --surface: #ffffff;
  --text: #101113;
  --text-2: #495057;
  --text-dim: #868e96;
  --border: #e9ecef;
  --border-2: #dee2e6;
  --shadow-xs: 0 1px 2px rgba(16, 17, 19, .04);
  --shadow-sm: 0 1px 3px rgba(16, 17, 19, .06), 0 1px 2px rgba(16, 17, 19, .04);
  --shadow-md: 0 4px 12px rgba(16, 17, 19, .08), 0 1px 3px rgba(16, 17, 19, .04);
  --shadow-lg: 0 12px 32px rgba(16, 17, 19, .12);
  --ring: 0 0 0 3px rgba(34, 139, 230, .18);
}

[data-theme="dark"] {
  --bg: #1a1b1e;
  --bg-soft: #202225;
  --bg-sunken: #161719;
  --surface: #242528;
  --text: #e9ecef;
  --text-2: #b8bcc2;
  --text-dim: #8b9097;
  --border: #2f3136;
  --border-2: #3a3d43;
  --primary-soft: #16293c;
  --green-soft: #16301f;
  --orange-soft: #33230f;
  --red-soft: #351b1b;
  --violet-soft: #241f3d;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
  --ring: 0 0 0 3px rgba(34, 139, 230, .28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.spacer { flex: 1 1 auto; }
.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .inner { display: flex; align-items: center; gap: 12px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #4dabf7);
  box-shadow: 0 2px 8px rgba(34, 139, 230, .35);
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 800;
}
.brand small { color: var(--text-dim); font-weight: 400; font-size: 12px; }
.nav-links { display: flex; gap: 2px; margin-left: 8px; }
.nav-links a {
  padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
}
.nav-links a:hover { background: var(--bg-sunken); color: var(--text); text-decoration: none; }
.nav-links a.active { background: var(--primary-soft); color: var(--primary-700); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, transform .06s, color .14s;
  box-shadow: var(--shadow-xs);
}
.btn:hover { background: var(--bg-sunken); border-color: var(--border-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(34, 139, 230, .4);
}
.btn.primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--bg-sunken); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--border-2)); }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn.lg { height: 40px; padding: 0 20px; font-size: 15px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.card.tight { padding: 14px 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-head h2 { font-size: 15.5px; }
.card-head .desc { color: var(--text-dim); font-size: 12.5px; }

/* ---------------- 表单 ---------------- */
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
  font-family: inherit; font-size: 13.5px;
  transition: border-color .14s, box-shadow .14s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:hover, select:hover { border-color: var(--text-dim); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--ring);
}
input::placeholder { color: var(--text-dim); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 550; color: var(--text-2); margin-bottom: 6px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%); background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

/* ---------------- 徽标 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 550; line-height: 1;
  background: var(--bg-sunken); color: var(--text-2); white-space: nowrap;
}
.badge.blue { background: var(--primary-soft); color: var(--primary-700); }
.badge.green { background: var(--green-soft); color: #2b8a3e; }
.badge.orange { background: var(--orange-soft); color: #d9480f; }
.badge.red { background: var(--red-soft); color: #c92a2a; }
.badge.violet { background: var(--violet-soft); color: #5f3dc4; }
[data-theme="dark"] .badge.blue { color: #74c0fc; }
[data-theme="dark"] .badge.green { color: #8ce99a; }
[data-theme="dark"] .badge.orange { color: #ffc078; }
[data-theme="dark"] .badge.red { color: #ffa8a8; }
[data-theme="dark"] .badge.violet { color: #b197fc; }
.dot-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------------- 表格 ---------------- */
.table-wrap {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: auto; background: var(--surface);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-soft);
  text-align: left; font-weight: 600; font-size: 12px;
  color: var(--text-dim); letter-spacing: .01em;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--bg-soft); }
tbody tr.sel { background: var(--primary-soft) !important; }
tbody tr.clickable { cursor: pointer; }
tbody tr.dim { opacity: .48; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------------- 统计卡 ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; }
.stat {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat .n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.2; }
.stat .n small { font-size: 14px; font-weight: 600; color: var(--text-dim); }
.stat .l { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.stat.accent { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.stat.accent .n { color: var(--primary-700); }
[data-theme="dark"] .stat.accent .n { color: #74c0fc; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background:
    radial-gradient(900px 260px at 8% -30%, rgba(34, 139, 230, .18), transparent 60%),
    radial-gradient(700px 240px at 92% -10%, rgba(121, 80, 242, .14), transparent 60%),
    var(--surface);
  padding: 30px 28px 26px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.hero h1 { font-size: 25px; letter-spacing: -.02em; margin-bottom: 6px; }
.hero .sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 18px; }
.hero .meta { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.hero .count { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.progress-track { height: 7px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.progress-track > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #4dabf7);
  transition: width .35s ease;
}

/* ---------------- 步骤 ---------------- */
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-sunken); color: var(--text-dim);
  display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.step-num.on { background: var(--primary); color: #fff; }
.step-num.done { background: var(--green-soft); color: #2b8a3e; }

/* ---------------- 上传区 ---------------- */
.dropzone {
  border: 1.5px dashed var(--border-2); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer;
  background: var(--bg-soft);
  transition: border-color .15s, background .15s, transform .1s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--primary); background: var(--primary-soft);
}
.dropzone.drag { transform: scale(.995); }
.dropzone .icon { font-size: 34px; line-height: 1; margin-bottom: 10px; opacity: .85; }
.dropzone .big { font-size: 14.5px; font-weight: 600; margin-bottom: 3px; }
.progress { height: 6px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; margin: 14px 0 8px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }

/* ---------------- 队伍列表 ---------------- */
.team-list {
  max-height: 316px; overflow: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.team-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border); font-size: 13.5px;
  transition: background .1s;
}
.team-item:last-child { border-bottom: 0; }
.team-item:hover { background: var(--bg-soft); }
.team-item.sel { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.team-item .school { margin-left: auto; color: var(--text-dim); font-size: 12px; }
.team-item.sel .school { color: var(--primary-700); }

/* ---------------- 选项卡 ---------------- */
.tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-sunken); border-radius: var(--radius);
  margin-bottom: 18px; width: fit-content; flex-wrap: wrap;
}
.tabs button {
  border: 0; background: transparent; color: var(--text-2);
  height: 32px; padding: 0 16px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background .14s, color .14s, box-shadow .14s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm); font-weight: 600;
}

/* ---------------- 任务卡 ---------------- */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.task-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; background: var(--surface);
  cursor: pointer; transition: border-color .14s, box-shadow .14s, transform .1s;
  display: flex; flex-direction: column; gap: 10px;
}
.task-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.task-card .top { display: flex; align-items: center; gap: 8px; }
.task-card .title { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card .metrics { display: flex; gap: 14px; font-size: 12px; color: var(--text-dim); }
.task-card .metrics b { color: var(--text); font-variant-numeric: tabular-nums; }
.bar { height: 5px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); }

/* ---------------- 抽屉 / 预览 ---------------- */
.drawer { position: fixed; inset: 0; background: rgba(10, 11, 13, .5); display: none; z-index: 60; backdrop-filter: blur(2px); }
.drawer.open { display: block; }
.drawer .panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(1240px, 94vw);
  background: var(--surface); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); border-left: 1px solid var(--border);
}
.drawer .panel > header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex: none;
}
.drawer .body { flex: 1; display: flex; min-height: 0; }
.doclist {
  width: 268px; flex: none; border-right: 1px solid var(--border);
  overflow: auto; background: var(--bg-soft); padding: 8px;
}
.doclist .item {
  padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 12.5px; display: flex; gap: 8px; align-items: center;
  color: var(--text-2);
}
.doclist .item:hover { background: var(--surface); color: var(--text); }
.doclist .item.active { background: var(--surface); color: var(--primary-700); box-shadow: var(--shadow-xs); font-weight: 550; }
.doclist .item .ext { font-family: var(--mono); font-size: 10.5px; color: var(--text-dim); margin-left: auto; }
.doclist .item.na { opacity: .5; cursor: default; }
.viewer-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-pane .bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex: none; background: var(--surface); }
.viewer-pane iframe { flex: 1; border: 0; width: 100%; background: #fff; }
.viewer-pane pre.viewer {
  flex: 1; overflow: auto; margin: 0; padding: 16px 18px;
  white-space: pre-wrap; word-break: break-word; line-height: 1.65;
  background: var(--bg); color: var(--text);
}

/* ---------------- 空状态 ---------------- */
.empty { text-align: center; padding: 46px 20px; color: var(--text-dim); }
.empty .ico { font-size: 30px; opacity: .5; margin-bottom: 8px; }
.empty .t { font-size: 14px; font-weight: 550; color: var(--text-2); margin-bottom: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 8px);
  background: #212529; color: #f8f9fa; padding: 10px 18px;
  border-radius: var(--radius); font-size: 13.5px; z-index: 100;
  opacity: 0; pointer-events: none; transition: .2s;
  box-shadow: var(--shadow-lg); max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[data-theme="dark"] .toast { background: #f1f3f5; color: #16181a; }

.hint { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; line-height: 1.6; }
.err { color: var(--red); font-size: 13px; }
.ok { color: var(--green); font-size: 13px; }
.kbd {
  display: inline-block; font-family: var(--mono); font-size: 10.5px;
  padding: 1px 5px; border: 1px solid var(--border-2); border-radius: 4px;
  background: var(--bg-soft); color: var(--text-2); line-height: 15px;
}
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1 1 320px; min-width: 0; }

/* ---------------- 骨架 ---------------- */
.skel { background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--bg-soft) 37%, var(--bg-sunken) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

@media (max-width: 720px) {
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: 20px; }
  .card { padding: 16px; }
  .drawer .panel { width: 100%; }
  .doclist { display: none; }
}
