:root {
  --bg: #f4fafd;
  --panel: #ffffff;
  --panel2: #e8f4fc;
  --border: #d9ebf7;
  --fg: #1f3a4d;
  --muted: #7c96ad;
  --accent: #0ea5e9;
  --accent2: #0284c7;
  --pink: #ff6b9d;
  --cyan: #18bfe0;
  --orange: #ff8a3d;
  --yellow: #ffc93d;
  --ok: #00c48c;
  --warn: #ff9f29;
  --bad: #ff5e7e;
  --codebg: #1a2b3c;
  --codeborder: #2d4659;
  --codefg: #dceefb;
  --shadow-sm: 0 2px 10px rgba(60,130,180,.08);
  --shadow-md: 0 8px 24px rgba(14,165,233,.14);
  --shadow-lg: 0 14px 36px rgba(14,165,233,.22);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(720px 420px at 100% -6%, rgba(255,107,157,.12), transparent 60%),
    radial-gradient(700px 440px at -6% 18%, rgba(14,165,233,.13), transparent 60%),
    radial-gradient(640px 420px at 50% 112%, rgba(24,191,224,.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg); min-height: 100vh;
}
::selection { background: rgba(14,165,233,.22); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 24px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(227,231,247,.8);
  box-shadow: var(--shadow-sm);
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: .5px; color: var(--fg); }
.brand .dot {
  background: linear-gradient(135deg, var(--accent), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a {
  color: var(--muted); padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  transition: all .15s ease;
}
.topbar nav a:hover { color: var(--accent); background: var(--panel2); text-decoration: none; }
.topbar nav a.active { color: #fff; background: linear-gradient(135deg, var(--accent), #38bdf8); box-shadow: 0 4px 12px rgba(14,165,233,.35); }
.topbar .userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--panel2); border: 1px solid transparent; color: var(--accent);
}
.badge.ok { color: #00a575; background: rgba(0,196,140,.13); }
.badge.warn { color: #e0840c; background: rgba(255,159,41,.15); }
.badge.bad { color: #e23e60; background: rgba(255,94,126,.13); }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }
.hero {
  position: relative; overflow: hidden;
  padding: 38px 34px; border-radius: 22px; margin-bottom: 26px;
  background: linear-gradient(120deg, #0ea5e9 0%, #38bdf8 28%, #e8c855 72%, #ff8a3d 100%);
  box-shadow: 0 16px 40px rgba(56,189,248,.30);
}
.hero > * { position: relative; z-index: 1; }
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.14);
}
.hero::before { width: 240px; height: 240px; top: -90px; right: -50px; animation: floatY 7s ease-in-out infinite; }
.hero::after { width: 130px; height: 130px; bottom: -50px; right: 150px; background: rgba(255,255,255,.10); animation: floatY 9s ease-in-out infinite reverse; }
.hero h1 { margin: 10px 0 10px; font-size: 32px; color: #fff; letter-spacing: .5px; }
.hero p { margin: 6px 0 0; color: rgba(255,255,255,.92); max-width: 720px; line-height: 1.75; }
.hero .tagline {
  display: inline-block; color: #fff; font-weight: 700; font-size: 13px;
  background: rgba(255,255,255,.20); padding: 5px 15px; border-radius: 999px;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  padding: 20px; box-shadow: var(--shadow-sm);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, border-color .2s;
}
a.card:hover, .card:hover {
  transform: translateY(-4px); border-color: transparent; box-shadow: var(--shadow-lg);
  text-decoration: none; color: inherit;
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.65; }

.section-title { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; font-size: 20px; color: var(--fg); }
.section-title .line { flex: 1; height: 3px; border-radius: 3px; background: linear-gradient(90deg, rgba(14,165,233,.5), rgba(255,107,157,.3), transparent); }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
th, td { text-align: left; padding: 11px 15px; font-size: 14px; border-bottom: 1px solid var(--border); }
th { background: var(--panel2); color: var(--accent); font-weight: 700; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgba(14,165,233,.05); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }

.list-row {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s, border-color .18s;
}
.list-row:hover { transform: translateY(-2px); border-color: rgba(14,165,233,.45); box-shadow: var(--shadow-md); }
.list-row .meta { color: var(--muted); font-size: 13px; }
.list-row .main { flex: 1; }
.list-row h3 { margin: 0 0 4px; font-size: 16px; }

.content-block {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 24px 28px; line-height: 1.9; font-size: 15px; white-space: normal;
}
.content-block h2, .content-block h3 { color: var(--fg); margin-top: 20px; }

form.inline { display: inline; margin: 0; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 700; }
label.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; font-weight: 400; color: var(--fg); }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 10px 13px; background: #fff; color: var(--fg);
  border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3.5px rgba(14,165,233,.16);
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; }
textarea { min-height: 120px; resize: vertical; }

.btn {
  display: inline-block; padding: 9px 18px; border-radius: 10px; border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), #38bdf8);
  color: #fff; font-size: 14px; cursor: pointer; font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(14,165,233,.32);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 7px 18px rgba(14,165,233,.42); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: #fff; border-color: var(--border); color: var(--accent); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); background: var(--panel2); filter: none; }
.btn.danger { background: rgba(255,94,126,.10); border-color: rgba(255,94,126,.5); color: var(--bad); box-shadow: none; }
.btn.danger:hover { background: rgba(255,94,126,.20); filter: none; box-shadow: none; }
.btn.sm { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; }

.form-card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-sm); padding: 24px 28px; margin-bottom: 20px; }
.form-card h2 { margin: 0 0 8px; font-size: 18px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s; }
a.stat { display: block; text-decoration: none; color: inherit; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat .n { font-size: 32px; font-weight: 800; color: var(--accent); }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; font-weight: 600; }
.stat:nth-child(1) { background: linear-gradient(135deg, #e2f5fe, #fff); border-color: #c2e8f9; }
.stat:nth-child(1) .n { color: #0ea5e9; }
.stat:nth-child(2) { background: linear-gradient(135deg, #ffe9f2, #fff); border-color: #ffd0e1; }
.stat:nth-child(2) .n { color: #f2518d; }
.stat:nth-child(3) { background: linear-gradient(135deg, #e2f7fd, #fff); border-color: #c0edf9; }
.stat:nth-child(3) .n { color: #0fa9c9; }
.stat:nth-child(4) { background: linear-gradient(135deg, #ffefe2, #fff); border-color: #ffdcc0; }
.stat:nth-child(4) .n { color: #f5761f; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; border: 1px solid; font-weight: 600; }
.alert.ok { background: rgba(0,196,140,.12); border-color: rgba(0,196,140,.4); color: #00a575; }
.alert.warn { background: rgba(255,159,41,.13); border-color: rgba(255,159,41,.45); color: #e0840c; }
.alert.bad { background: rgba(255,94,126,.11); border-color: rgba(255,94,126,.4); color: #e23e60; }

.qblock { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 18px 22px; margin-bottom: 14px; }
.qblock .qhead { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.qblock .qhead .pts { color: var(--orange); font-weight: 700; font-size: 13px; white-space: nowrap; }
.qblock .opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border-radius: 10px; cursor: pointer; transition: background .12s; }
.qblock .opt:hover { background: var(--panel2); }
.qblock .opt input { margin-top: 3px; }
.score-big {
  font-size: 66px; font-weight: 800; text-align: center; padding: 20px 0;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px; border-top: 1px solid var(--border); }
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Cascadia Code", monospace; }
.code {
  display: block; background: var(--codebg); border: 1px solid var(--codeborder); border-radius: 12px;
  padding: 12px 16px; white-space: pre-wrap; font-family: Consolas, monospace; font-size: 13px; color: var(--codefg);
}
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: var(--muted); font-size: 13.5px; font-weight: 600; transition: all .15s; }
.tabs a.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--accent), #38bdf8); box-shadow: 0 4px 12px rgba(14,165,233,.32); }
.tabs a:hover { text-decoration: none; color: var(--accent); border-color: var(--accent); }
.tabs a.active:hover { color: #fff; }
.empty {
  color: var(--muted); text-align: center; padding: 32px 0; font-weight: 600;
  border: 2px dashed var(--border); border-radius: 16px; background: rgba(255,255,255,.55);
}

/* 在线编译运行 */
.run-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .run-grid { grid-template-columns: 1fr; } }

/* Markdown 内容样式 */
.md-content h1 { font-size: 24px; margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.md-content h2 { font-size: 20px; margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.md-content h3 { font-size: 17px; margin: 18px 0 8px; color: var(--accent); }
.md-content h4 { font-size: 15px; margin: 14px 0 6px; color: var(--fg); }
.md-content p { margin: 10px 0; line-height: 1.8; }
.md-content ul, .md-content ol { margin: 10px 0; padding-left: 28px; line-height: 1.8; }
.md-content li { margin: 4px 0; }
.md-content strong { color: #0f4c75; }
.md-content blockquote {
  margin: 12px 0; padding: 10px 16px; border-left: 4px solid #86cff0;
  background: rgba(14,165,233,.08); border-radius: 0 10px 10px 0; color: var(--muted);
}
.md-content code {
  background: #e4f5fd; padding: 2px 7px; border-radius: 6px;
  font-family: Consolas, "Cascadia Code", monospace; font-size: 13.5px; color: var(--accent);
  border: 1px solid #cde9f7;
}
.md-content pre {
  background: var(--codebg); border: 1px solid var(--codeborder); border-radius: 12px;
  padding: 14px 18px; overflow-x: auto; margin: 12px 0;
}
.md-content pre code {
  background: none; border: none; padding: 0; font-size: 13px; color: var(--codefg);
}
.md-content table {
  width: auto; margin: 12px 0; border-radius: 12px; font-size: 14px;
}
.md-content th, .md-content td {
  padding: 8px 14px; border-bottom: 1px solid var(--border);
}
.md-content th { background: var(--panel2); }
.md-content hr { border: none; border-top: 2px solid var(--border); margin: 20px 0; }
.md-content a { color: var(--accent); }
.md-content img { max-width: 100%; border-radius: 10px; }

/* 代码编辑器 */
.code-editor {
  width: 100%;
  padding: 14px 16px;
  background: var(--codebg);
  color: var(--codefg);
  border: 1.5px solid var(--codeborder);
  border-radius: 12px;
  font-family: Consolas, "Cascadia Code", "Fira Code", monospace;
  font-size: 13.5px;
  line-height: 1.6;
  resize: vertical;
  tab-size: 4;
}
.code-editor:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3.5px rgba(14,165,233,.18); }

/* 评测状态 */
.judge-status {
  font-size: 13.5px;
  font-weight: 700;
  padding: 4px 13px;
  border-radius: 999px;
  background: var(--panel2);
  color: var(--accent);
}
.judge-status.ok { color: #00a575; background: rgba(0,196,140,.13); border: 1px solid rgba(0,196,140,.4); }
.judge-status.warn { color: #e0840c; background: rgba(255,159,41,.15); border: 1px solid rgba(255,159,41,.45); }
.judge-status.bad { color: #e23e60; background: rgba(255,94,126,.12); border: 1px solid rgba(255,94,126,.4); }

.q-panel { animation: fadeIn .25s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 500px) { .brand { display: none; } .topbar{gap:0;padding: 3px 20px;} .topbar nav a {padding: 5px;}}