/* ============================================================
   NUC 大数据与网络安全实验室 · 新生纳新赛  样式表
   纯手写 CSS，无外部依赖（内网/CDN 受限也能正常渲染）
   ============================================================ */

:root {
  --bg:        #0b0f14;
  --bg-soft:   #111823;
  --bg-card:   #151d29;
  --bg-hover:  #1b2534;
  --border:    #24303f;
  --border-hi: #33465c;

  --fg:        #e6edf5;
  --fg-dim:    #93a4b8;
  --fg-faint:  #64748b;

  --accent:    #2ee6a8;
  --accent-dim:#17795a;
  --cyan:      #38bdf8;
  --amber:     #fbbf24;
  --rose:      #fb7185;
  --violet:    #a78bfa;

  /* 已解出卡片：墨绿整块底色 */
  --solved-bg:     #0e2a20;
  --solved-bg-hi:  #123527;
  --solved-border: #1f7a55;
  --solved-fg:     #d3f6e8;

  /* 赛道配色 */
  --web:  #38bdf8;
  --pwn:  #fb7185;
  --rev:  #a78bfa;
  --misc: #fbbf24;

  --radius:    14px;
  --radius-sm: 9px;
  --mono: "JetBrains Mono", "Cascadia Mono", "SF Mono", Consolas,
          "Liberation Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC",
          "Microsoft YaHei", "Noto Sans SC", sans-serif;

  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 12% -8%, rgba(46, 230, 168, .09), transparent 60%),
    radial-gradient(1000px 500px at 88% 4%, rgba(56, 189, 248, .08), transparent 55%),
    var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd, pre, .mono { font-family: var(--mono); }

/* ---------------- 布局 ---------------- */
.wrap { width: min(1180px, 100% - 40px); margin-inline: auto; }

header.site {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(11, 15, 20, .82);
  border-bottom: 1px solid var(--border);
}
.site-inner {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 0; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; }
/* 实验室 logo（assets/logo.png：黑色圆形徽章 + </> + Datsec，圆形外透明） */
.brand .logo {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; overflow: hidden;
  background: #000;
  /* 深色顶栏上给一圈柔和描边，避免黑徽章糊在背景里 */
  box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 2px 10px -4px rgba(0,0,0,.9);
}
.brand .logo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand .t1 { font-size: 15px; letter-spacing: .2px; }
.brand .t2 { font-size: 11px; color: var(--fg-faint); font-weight: 500; letter-spacing: .6px; }

nav.tabs { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
nav.tabs button {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  background: transparent; color: var(--fg-dim);
  font: inherit; font-size: 14px; padding: 7px 14px; border-radius: 9px;
  transition: .15s;
}
nav.tabs button:hover { color: var(--fg); background: var(--bg-hover); }
nav.tabs button.active {
  color: #06231a; background: var(--accent); font-weight: 650;
}

.team-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 6px 5px 14px; font-size: 13px;
}
.team-chip .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.team-chip .name { color: var(--fg); font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-chip button {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-size: 12px;
  background: var(--bg-hover); color: var(--fg-dim);
  padding: 4px 10px; border-radius: 999px;
}
.team-chip button:hover { color: var(--rose); }

main { padding: 34px 0 80px; }

.view { display: none; }
.view.active { display: block; animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(7px); } }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

h1 { font-size: 30px; margin: 0 0 8px; letter-spacing: -.4px; }
h2 { font-size: 20px; margin: 0 0 14px; letter-spacing: -.2px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p.lead { color: var(--fg-dim); margin: 0 0 20px; max-width: 70ch; }

.muted { color: var(--fg-dim); }
.faint { color: var(--fg-faint); }
.small { font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .3px;
  padding: 3px 9px; border-radius: 999px; border: 1px solid;
  text-transform: uppercase;
}
.badge.easy   { color: var(--accent); border-color: var(--accent-dim); background: rgba(46,230,168,.10); }
.badge.medium { color: var(--amber);  border-color: #7c5c12; background: rgba(251,191,36,.10); }
.badge.hard   { color: var(--rose);   border-color: #7f2c3c; background: rgba(251,113,133,.10); }
.badge.solved { color: var(--accent); border-color: var(--accent-dim); background: rgba(46,230,168,.14); }
.badge.live   { color: var(--accent); border-color: var(--accent-dim); background: rgba(46,230,168,.10); }
.badge.live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; animation: pulse 1.6s ease-in-out infinite;
}
.badge.live.off { color: var(--fg-faint); border-color: var(--border-hi); background: transparent; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* 最近解题（实时流） */
.feed { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.feed .row-f { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--border); }
.feed .row-f:last-child { border-bottom: 0; }
.feed .who { font-weight: 620; }
.feed .cid { font-family: var(--mono); font-size: 11.5px; color: var(--fg-faint); }
.feed .at  { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--fg-faint); }
.feed .new { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: rgba(46,230,168,.20); } 100% { background: transparent; } }

button.btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px;
  border-radius: var(--radius-sm); padding: 10px 18px;
  border: 1px solid var(--border-hi); background: var(--bg-hover); color: var(--fg);
  transition: .15s;
}
button.btn:hover { border-color: var(--accent); color: var(--accent); }
button.btn.primary {
  background: linear-gradient(140deg, var(--accent), #22c9a0);
  border-color: transparent; color: #06231a;
}
button.btn.primary:hover { filter: brightness(1.08); color: #06231a; }
button.btn:disabled { opacity: .45; cursor: not-allowed; }

input, select, textarea {
  font: inherit; font-size: 14px; color: var(--fg);
  background: var(--bg); border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm); padding: 10px 13px; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 230, 168, .14);
}
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--fg-dim); margin-bottom: 6px; }

pre.code {
  background: #070b10; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  overflow-x: auto; font-size: 13px; margin: 0;
  color: #cfe3db;
}
pre.code .cmt { color: var(--fg-faint); }

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

.notice {
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13.5px;
  border: 1px solid; margin-bottom: 14px;
}
.notice.info  { border-color: #1e4a63; background: rgba(56,189,248,.09); color: #b9e2f7; }
.notice.ok    { border-color: var(--accent-dim); background: rgba(46,230,168,.10); color: #a9f0d6; }
.notice.warn  { border-color: #7c5c12; background: rgba(251,191,36,.10); color: #f7e0a8; }
.notice.error { border-color: #7f2c3c; background: rgba(251,113,133,.10); color: #f9c3cc; }

/* ---------------- 首页 Hero ---------------- */
.hero {
  border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  background: linear-gradient(150deg, #101a24 0%, #0d141d 55%, #0b0f14 100%);
  padding: 40px; position: relative; margin-bottom: 22px;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(46,230,168,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46,230,168,.045) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(600px 300px at 80% 0%, #000, transparent 75%);
}
.hero > * { position: relative; z-index: 1; }
.hero .kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: 2.4px;
  color: var(--accent); text-transform: uppercase; margin-bottom: 12px;
}
.hero h1 { font-size: clamp(26px, 4.4vw, 40px); line-height: 1.22; }
.hero .sub { color: var(--fg-dim); max-width: 62ch; margin: 12px 0 24px; }

.stats { display: flex; gap: 26px; flex-wrap: wrap; }
.stat .n { font-family: var(--mono); font-size: 25px; font-weight: 700; color: var(--accent); line-height: 1.2; }
.stat .l { font-size: 12px; color: var(--fg-faint); letter-spacing: .5px; }

.track-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; background: var(--bg-card); border-top: 3px solid var(--border-hi);
  transition: .18s; cursor: pointer;
}
.track-card:hover { background: var(--bg-hover); transform: translateY(-2px); }
.track-card[data-cat="web"]  { border-top-color: var(--web); }
.track-card[data-cat="pwn"]  { border-top-color: var(--pwn); }
.track-card[data-cat="reverse"] { border-top-color: var(--rev); }
.track-card[data-cat="misc"] { border-top-color: var(--misc); }
.track-card .ic { font-size: 22px; margin-bottom: 8px; }
.track-card .nm { font-weight: 700; font-size: 16px; }
.track-card .de { font-size: 13px; color: var(--fg-dim); margin-top: 5px; }
.track-card .pg { margin-top: 12px; height: 4px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.track-card .pg i { display: block; height: 100%; background: var(--accent); width: 0; transition: .4s; }

.tl { list-style: none; padding: 0; margin: 0; }
.tl li { position: relative; padding: 0 0 16px 26px; border-left: 1px solid var(--border); }
.tl li:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl li::before {
  content: ""; position: absolute; left: -5px; top: 7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(46,230,168,.16);
}
.tl .tt { font-weight: 600; font-size: 14px; }
.tl .td { font-size: 13px; color: var(--fg-dim); }

/* ---------------- 题目列表 ---------------- */
.cat-block { margin-bottom: 30px; }
.cat-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.cat-head .bar { width: 4px; height: 22px; border-radius: 3px; }
.cat-head[data-cat="web"] .bar  { background: var(--web); }
.cat-head[data-cat="pwn"] .bar  { background: var(--pwn); }
.cat-head[data-cat="reverse"] .bar { background: var(--rev); }
.cat-head[data-cat="misc"] .bar { background: var(--misc); }
.cat-head .nm { font-size: 17px; font-weight: 700; }
.cat-head .ct { margin-left: auto; font-size: 13px; color: var(--fg-faint); font-family: var(--mono); }

.ch-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); padding: 16px; display: flex; flex-direction: column;
  transition: .16s;
}
.ch-card:hover { border-color: var(--border-hi); background: var(--bg-hover); }

/* ---- 已解出：整块卡片换成墨绿色，不只是描边 ---- */
.ch-card.solved {
  border-color: var(--solved-border);
  background: linear-gradient(180deg, rgba(46,230,168,.075), rgba(46,230,168,.015)), var(--solved-bg);
  box-shadow: inset 3px 0 0 0 var(--accent), 0 6px 20px -14px rgba(46,230,168,.5);
}
.ch-card.solved:hover {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(46,230,168,.12), rgba(46,230,168,.04)), var(--solved-bg-hi);
}
.ch-card.solved .id  { color: #59a98a; }
.ch-card.solved .ttl { color: var(--solved-fg); }
.ch-card.solved .de  { color: #9cc8b6; }
.ch-card.solved .tags span {
  background: rgba(46,230,168,.08);
  border-color: rgba(46,230,168,.24);
  color: #8adcbc;
}
.ch-card.solved .pts { color: #4ee8b4; }
/* 已解出卡片底部那枚徽章做实心，最醒目 */
.ch-card.solved .badge.solved {
  background: var(--accent); border-color: var(--accent);
  color: #05170f; font-weight: 800;
}
.ch-card .top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 9px; }
.ch-card .id { font-family: var(--mono); font-size: 11.5px; color: var(--fg-faint); }
.ch-card .ttl { font-weight: 650; font-size: 15px; line-height: 1.4; flex: 1; }
.ch-card .pts { font-family: var(--mono); font-size: 13px; color: var(--amber); font-weight: 700; }
.ch-card .de { font-size: 13px; color: var(--fg-dim); flex: 1; margin-bottom: 13px; }
.ch-card .foot { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.ch-card .foot .sp { margin-left: auto; font-size: 12px; }
.ch-card .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 11px; }
.ch-card .tags span {
  font-size: 11px; color: var(--fg-faint); background: var(--bg);
  border: 1px solid var(--border); border-radius: 5px; padding: 2px 7px;
  font-family: var(--mono);
}

/* ---------------- 表格 ---------------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--border); }
table.tbl th {
  font-size: 12px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--fg-faint); font-weight: 650;
}
table.tbl tbody tr:hover { background: var(--bg-hover); }
table.tbl td.rk { font-family: var(--mono); font-weight: 700; width: 62px; }
table.tbl td.sc { font-family: var(--mono); font-weight: 700; color: var(--accent); }
table.tbl tr.me { background: rgba(46,230,168,.07); }
table.tbl tr.me td { border-bottom-color: var(--accent-dim); }
.medal { font-size: 16px; }

/* ---------------- 弹窗 ---------------- */
.modal-back {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(4, 7, 10, .74); backdrop-filter: blur(5px);
  padding: 30px 18px; overflow-y: auto;
}
.modal-back.open { display: block; }
.modal {
  width: min(680px, 100%); margin: 0 auto; animation: pop .2s ease;
  background: var(--bg-soft); border: 1px solid var(--border-hi);
  border-radius: 16px; box-shadow: 0 30px 70px -20px #000;
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(10px); } }
.modal-head { display: flex; align-items: flex-start; gap: 14px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
/* 已解出的题目：弹窗表头也带上墨绿 */
.modal.solved { border-color: var(--solved-border); }
.modal.solved .modal-head {
  background: linear-gradient(180deg, rgba(46,230,168,.11), rgba(46,230,168,0));
  border-bottom-color: rgba(46,230,168,.22);
}
.modal.solved .modal-head h2 { color: var(--solved-fg); }
.modal.solved .badge.solved {
  background: var(--accent); border-color: var(--accent);
  color: #05170f; font-weight: 800;
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head .x {
  appearance: none; border: 1px solid var(--border); background: var(--bg-card);
  color: var(--fg-dim); cursor: pointer; font-size: 17px; line-height: 1;
  width: 30px; height: 30px; border-radius: 8px; margin-left: auto; flex: 0 0 auto;
}
.modal-head .x:hover { color: var(--rose); border-color: var(--rose); }
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center;
}

/* ---------------- 提示条 ---------------- */
#toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; max-width: 340px;
}
.toast {
  border-radius: var(--radius-sm); padding: 11px 15px; font-size: 13.5px;
  background: var(--bg-card); border: 1px solid var(--border-hi);
  box-shadow: var(--shadow); animation: pop .2s ease;
}
.toast.ok    { border-color: var(--accent-dim); color: #a9f0d6; }
.toast.error { border-color: #7f2c3c; color: #f9c3cc; }
.toast.info  { border-color: #1e4a63; color: #b9e2f7; }

footer.site {
  border-top: 1px solid var(--border); padding: 22px 0;
  color: var(--fg-faint); font-size: 13px;
}
footer.site .wrap { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%; display: inline-block;
  border: 2px solid var(--border-hi); border-top-color: var(--accent);
  animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 40px 16px; color: var(--fg-faint); }
.empty .ic { font-size: 32px; margin-bottom: 10px; }

@media (max-width: 720px) {
  .wrap { width: calc(100% - 26px); }
  .hero { padding: 26px 20px; }
  .site-inner { gap: 10px; }
  nav.tabs { width: 100%; order: 3; margin-left: 0; }
  nav.tabs button { flex: 1; text-align: center; padding: 8px 6px; font-size: 13px; }
  main { padding: 22px 0 60px; }
  table.tbl { font-size: 13px; }
  table.tbl th, table.tbl td { padding: 9px 8px; }
}
