* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #0f1115; color: #e6e8ee; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif; font-size: 14px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* 导航 */
.nav { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 18px; padding: 12px 28px; background: rgba(13, 16, 22, .85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid #1e2430; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; color: #fff; letter-spacing: .5px; }
.logo-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2f6bff, #7b5cff); color: #fff; font-size: 17px; box-shadow: 0 4px 14px rgba(47, 107, 255, .35); flex-shrink: 0; }
.search-wrap { position: relative; flex: 1; max-width: 440px; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #6c7487; pointer-events: none; }
.search-btn { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; border-radius: 50%; cursor: pointer; z-index: 2; transition: background .15s; }
.search-btn:hover { background: rgba(255, 255, 255, .06); }
.search { width: 100%; background: #0e1117; border: 1px solid #262d3d; border-radius: 999px; padding: 10px 16px 10px 38px; color: #c9d0dd; outline: none; transition: border-color .2s, box-shadow .2s; }
.search:focus { border-color: #2f6bff; box-shadow: 0 0 0 3px rgba(47, 107, 255, .15); }
.nav-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.btn { display: inline-block; border: none; border-radius: 10px; padding: 10px 18px; font-size: 14px; cursor: pointer; font-weight: 600; text-align: center; }
.btn-primary { background: linear-gradient(135deg, #2f6bff, #4a7dff); color: #fff; box-shadow: 0 4px 12px rgba(47, 107, 255, .25); transition: transform .15s, box-shadow .15s; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(47, 107, 255, .35); }
.btn-ghost { background: transparent; border: 1px solid #2a3140; color: #c9d0dd; transition: border-color .15s, color .15s; }
.btn-ghost:hover { border-color: #3a76ff; color: #fff; }
.btn-danger { background: linear-gradient(135deg, #e5484d, #f2555a); color: #fff; box-shadow: 0 4px 12px rgba(229, 72, 77, .25); transition: transform .15s, box-shadow .15s; }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(229, 72, 77, .35); }
.user-box { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: rgba(47, 107, 255, .15); color: #7ea5ff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; border: 1px solid rgba(47, 107, 255, .35); flex-shrink: 0; }
.avatar.big { width: 56px; height: 56px; font-size: 22px; }
.user-name { color: #c9d0dd; font-size: 14px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 布局 */
.layout { display: flex; gap: 20px; padding: 20px 24px; align-items: flex-start; max-width: 1400px; margin: 0 auto; }
.sidebar { width: 190px; flex-shrink: 0; position: sticky; top: 80px; background: #141822; border-radius: 14px; padding: 12px 8px; }
.sidebar .cat { padding: 10px 14px; border-radius: 10px; color: #b9c0cf; cursor: pointer; font-size: 14px; margin-bottom: 2px; }
.sidebar .cat:hover { background: #1b2130; }
.sidebar .cat.active { background: #2f6bff; color: #fff; font-weight: 600; }
.main { flex: 1; min-width: 0; }

/* 工具栏 */
.toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar h1 { font-size: 18px; color: #fff; font-weight: 700; }
.sort-btn { color: #8a93a6; cursor: pointer; font-size: 14px; padding-bottom: 3px; border: none; background: none; }
.sort-btn.active { color: #fff; border-bottom: 2px solid #2f6bff; font-weight: 600; }
.count { margin-left: auto; color: #6c7487; font-size: 13px; }

/* 卡片网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: #141822; border: 1px solid #1f2634; border-radius: 14px; padding: 14px; cursor: pointer; transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); border-color: #2f6bff; }
.card-code { background: #0e1117; border: 1px solid #1b2130; border-radius: 10px; padding: 12px; font-family: "SF Mono", Menlo, Consolas, monospace; color: #6f7a92; font-size: 11px; line-height: 1.5; margin-bottom: 10px; height: 64px; overflow: hidden; }
.card-name { font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { font-size: 12px; color: #767f92; margin-bottom: 10px; }
.card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.author { font-size: 12px; color: #aab2c3; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stars { font-size: 12px; color: #ffb94d; }
.stars em { color: #6c7487; font-style: normal; margin-left: 2px; }
.dl-count { font-size: 12px; color: #6c7487; }
.btn-download { margin-left: auto; background: #2f6bff; color: #fff; border: none; border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-download:hover { background: #3a76ff; }
.btn-like { background: transparent; border: 1px solid #2a3140; color: #ff5a79; border-radius: 8px; padding: 7px 10px; font-size: 12px; cursor: pointer; }
.btn-like.liked { background: #ff5a7922; border-color: #ff5a79; }
.loadmore { text-align: center; margin: 24px 0 48px; }
.empty { text-align: center; color: #6c7487; padding: 80px 0; }

/* 详情页 */
.detail-wrap { max-width: 900px; margin: 24px auto; padding: 0 20px; }
.back-btn { display: inline-block; margin-bottom: 16px; }
.detail-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-title { font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.detail-meta { color: #767f92; font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.detail-desc { color: #aab2c3; line-height: 1.7; margin-bottom: 20px; white-space: pre-wrap; }
.json-box { background: #0e1117; border: 1px solid #1b2130; border-radius: 14px; padding: 18px; overflow-x: auto; margin-bottom: 24px; }
.json-box pre { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; color: #c9d0dd; }
.json-box .key { color: #79b8ff; }
.json-box .str { color: #7ee787; }
.json-box .num { color: #ffab70; }
.json-box .bool { color: #f97583; }
.json-box .null { color: #6f7a92; }
.rate-section { background: #141822; border: 1px solid #1f2634; border-radius: 14px; padding: 18px; margin-bottom: 20px; }
.rate-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.rate-avg { font-size: 40px; font-weight: 800; color: #ffb94d; }
.rate-avg small { font-size: 14px; color: #767f92; font-weight: 400; }
.rate-stars { font-size: 26px; color: #3a4254; cursor: pointer; user-select: none; letter-spacing: 4px; }
.rate-stars .on { color: #ffb94d; }
.rate-tip { font-size: 12px; color: #767f92; margin-top: 8px; }

/* 表单 */
.form-wrap { max-width: 520px; margin: 48px auto; padding: 0 20px; }
.form-card { background: #141822; border: 1px solid #1f2634; border-radius: 16px; padding: 28px; }
.form-card h2 { font-size: 20px; color: #fff; margin-bottom: 20px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #aab2c3; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea { width: 100%; background: #0f1115; border: 1px solid #262d3d; border-radius: 10px; padding: 11px 14px; color: #e6e8ee; font-size: 14px; outline: none; font-family: inherit; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #2f6bff; }
.form-input.invalid { border-color: #f97583; }
.field-hint { color: #f97583; font-size: 12px; margin-top: 5px; line-height: 1.4; }
.form-textarea { min-height: 90px; resize: vertical; }
.form-file { width: 100%; background: #0f1115; border: 1px dashed #2a3140; border-radius: 10px; padding: 20px; color: #8a93a6; font-size: 13px; text-align: center; cursor: pointer; }
.form-file.has-file { border-color: #2f6bff; color: #7ee787; }
.form-error { color: #f97583; font-size: 13px; margin-bottom: 12px; display: none; }
.form-success { color: #7ee787; font-size: 13px; margin-bottom: 12px; display: none; }
.preview-box { background: #0e1117; border: 1px solid #1b2130; border-radius: 10px; padding: 12px; font-family: monospace; font-size: 12px; color: #7ee787; max-height: 180px; overflow: auto; margin-top: 8px; display: none; white-space: pre-wrap; }
.switch-link { text-align: center; margin-top: 16px; color: #767f92; font-size: 13px; }
.switch-link a { color: #2f6bff; }

/* 提示条 */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1b2130; color: #e6e8ee; border: 1px solid #2a3140; border-radius: 10px; padding: 12px 20px; font-size: 14px; z-index: 999; display: none; }
.toast.show { display: block; }

/* 确认弹层 */
.confirm-mask { position: fixed; inset: 0; background: rgba(6, 8, 12, .7); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.confirm-box { background: #141822; border: 1px solid #262d3d; border-radius: 16px; padding: 26px 24px; max-width: 360px; width: 100%; }
.confirm-title { font-size: 18px; font-weight: 800; color: #fff; margin-bottom: 12px; text-align: center; }
.confirm-text { color: #aab2c3; font-size: 14px; line-height: 1.7; text-align: center; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; padding: 12px; }

/* 详情页作者链接 */
.author-link { color: #4f83ff; text-decoration: none; font-weight: 600; }
.author-link:hover { text-decoration: underline; }
.author-head { display: flex; align-items: center; color: #fff; margin: 22px 0 12px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* 响应式 */
@media (max-width: 768px) {
  .nav { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .search-wrap { order: 3; max-width: none; width: 100%; }
  .layout { padding: 14px; flex-direction: column; }
  .sidebar { width: 100%; position: static; display: flex; overflow-x: auto; padding: 8px; gap: 6px; }
  .sidebar .cat { white-space: nowrap; margin-bottom: 0; }
  .detail-title { font-size: 20px; }
  .nav-actions { gap: 8px; }
  .user-name { max-width: 90px; }
}

/* 个人主页 */
.profile-wrap { max-width: 1000px; margin: 28px auto; padding: 0 20px; }
.profile-head { display: flex; align-items: center; gap: 16px; background: #141822; border: 1px solid #1f2634; border-radius: 16px; padding: 22px 24px; }
.profile-name { font-size: 20px; font-weight: 800; color: #fff; }
.profile-sub { font-size: 13px; color: #767f92; margin-top: 4px; }
