:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #16202c;
  --muted: #6b7a8d;
  --line: #e3e9f0;
  --brand: #2f6bed;
  --brand-soft: #e8efff;
  --accent: #0fa59a;
  --danger: #e5484d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 30, 50, .04), 0 8px 24px rgba(16, 30, 50, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.container { max-width: 1080px; margin: 0 auto; padding: 0 18px; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 18px;
  height: 58px; display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.logo {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 800;
}
.nav-links { display: flex; gap: 4px; margin-left: 6px; }
.nav-links a {
  padding: 7px 12px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 500;
}
.nav-links a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .16s; font-family: inherit;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn.danger { background: var(--danger); }

/* ---------- 通用 ---------- */
h1 { font-size: 26px; margin: 26px 0 6px; letter-spacing: -.3px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.pad { padding: 20px; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input, textarea, select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; color: var(--ink); background: #fff; outline: none; transition: .16s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 90px; }

.hint { font-size: 13px; color: var(--muted); }
.alert { padding: 10px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; display: none; }
.alert.err { background: #fff1f1; color: #b4232a; display: block; }
.alert.ok { background: #eafaf3; color: #0a7d55; display: block; }

/* ---------- 作品网格 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 200px; }
.chips { display: flex; gap: 8px; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.chip.on { background: var(--brand-soft); border-color: #c9dbff; color: var(--brand); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 16px; }
.work-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: .18s; display: block;
}
.work-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(16,30,50,.1); text-decoration: none; }
.thumb {
  aspect-ratio: 4 / 3; display: grid; place-items: center;
  background: linear-gradient(135deg, #eef3ff, #e9f7f4);
  color: var(--brand); font-weight: 800; font-size: 28px; letter-spacing: 1px;
}
.thumb.py { background: linear-gradient(135deg, #eaf7ee, #f3f9e9); color: #2f8f4e; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-body { padding: 13px 14px 14px; }
.work-title { font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ---------- 详情页 ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; margin-top: 20px; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }
.player { width: 100%; aspect-ratio: 4 / 3; border: 0; border-radius: 12px; background: #0e1621; display: block; }
.work-head { margin: 18px 0 12px; }
.work-head h1 { margin: 0 0 8px; font-size: 23px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.stat { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }

.comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.comment-head b { color: var(--ink); }
.comment-head time { color: var(--muted); margin-left: auto; font-size: 12px; }
.comment-body { margin-top: 5px; white-space: pre-wrap; word-break: break-word; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff;
  font-weight: 700; font-size: 14px; flex: none;
}

/* ---------- 上传 ---------- */
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px;
  text-align: center; color: var(--muted); cursor: pointer; transition: .18s; background: #fff;
}
.drop:hover, .drop.hot { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 12px; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .2s; }

/* ---------- 编辑器 ---------- */
.editor-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; margin-top: 18px; }
@media (max-width: 900px) { .editor-wrap { grid-template-columns: 1fr; } }
.code {
  width: 100%; min-height: 460px; padding: 16px; border-radius: 12px; border: 1px solid var(--line);
  font: 14px/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  tab-size: 4; background: #fbfcfe; color: #1b2430;
}
.console {
  min-height: 180px; max-height: 300px; overflow: auto; padding: 12px; border-radius: 12px;
  background: #0e1621; color: #cfe3ff; font: 13px/1.6 "SFMono-Regular", Consolas, monospace;
  white-space: pre-wrap; word-break: break-word;
}
.console .err { color: #ff9a9a; }

footer { margin: 50px 0 30px; text-align: center; color: var(--muted); font-size: 13px; }
