/* ===== 设计系统：暗色科技风 · AI 短剧美学 ===== */
:root {
  --bg: #0b0d17;
  --bg-soft: #141727;
  --panel: #1a1e32;
  --panel-2: #222743;
  --line: #2c3150;
  --text: #e8ebf5;
  --text-dim: #9aa3c4;
  --text-mute: #6b7299;
  --brand: #7c5cff;
  --brand-2: #ff5ca8;
  --ok: #2bd67b;
  --warn: #ffb020;
  --danger: #ff5c6c;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --grad: linear-gradient(135deg, #7c5cff 0%, #ff5ca8 100%);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #251a4d 0%, transparent 60%), var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; width: 100%; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124,92,255,.18); }
/* v18：键盘无障碍 —— 仅键盘操作时显示焦点环，鼠标点击不打扰；button/a 也要可见 */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
textarea { resize: vertical; min-height: 90px; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 22px;
  padding: 14px 28px; background: rgba(11,13,23,.78); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.logo .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; font-size: 17px; }
.nav { display: flex; gap: 6px; }
.nav a { padding: 8px 14px; border-radius: 10px; color: var(--text-dim); font-size: 14px; font-weight: 600; }
.nav a:hover { background: var(--panel); color: var(--text); }
.topbar .spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: 16px; border: 1px solid var(--line); }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: none; border-radius: 11px; padding: 11px 18px; font-size: 14px; font-weight: 700; color: #fff; background: var(--grad); transition: transform .12s, opacity .12s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.ok { background: transparent; color: var(--ok); border: 1px solid var(--ok); }
.btn.block { width: 100%; }

/* ===== 布局 ===== */
.wrap { max-width: 1180px; margin: 0 auto; padding: 30px 24px 80px; }
.wrap.narrow { max-width: 720px; }
.wrap.mid { max-width: 1080px; }
.section { margin-top: 46px; }
.section h2 { font-size: 22px; margin-bottom: 4px; }
.section .sub { color: var(--text-dim); font-size: 14px; margin-bottom: 20px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.row h2 { margin-bottom: 0; }

/* ===== Hero ===== */
.hero { text-align: center; padding: 56px 20px 30px; }
.hero .badge { display: inline-block; padding: 5px 13px; border-radius: 999px; background: rgba(124,92,255,.16); color: #b9a8ff; font-size: 13px; font-weight: 600; margin-bottom: 18px; border: 1px solid rgba(124,92,255,.3); }
.hero h1 { font-size: 44px; line-height: 1.15; letter-spacing: -.5px; }
.hero h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--text-dim); font-size: 17px; max-width: 620px; margin: 18px auto 26px; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== 卡片网格 ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .14s, border-color .14s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-3px); border-color: #3a4170; }
.card .cover { height: 120px; display: grid; place-items: center; font-size: 52px; background: linear-gradient(135deg, #1f2440, #2a2150); }
.card .body { padding: 15px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .body h3 { font-size: 16px; line-height: 1.35; }
.card .body .desc { color: var(--text-dim); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.card .meta { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; }
.price { font-weight: 800; font-size: 16px; color: #ffd479; }
.price.free { color: var(--ok); }
.blogger { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); }
.blogger .av { width: 22px; height: 22px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: 12px; }

/* ===== 徽标 ===== */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag.published { background: rgba(43,214,123,.14); color: var(--ok); }
.tag.off { background: rgba(255,176,32,.14); color: var(--warn); }
.tag.draft { background: rgba(154,163,196,.16); color: var(--text-dim); }
.tag.role { background: rgba(124,92,255,.16); color: #b9a8ff; }

/* ===== 帖子 ===== */
.post { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.post + .post { margin-top: 14px; }
.post .head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.post .head .av { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; }
.post .head .name { font-weight: 700; font-size: 14px; }
.post .head .time { color: var(--text-mute); font-size: 12px; }
.post h3 { font-size: 16px; margin-bottom: 6px; }
.post .content { color: var(--text-dim); font-size: 14px; white-space: pre-wrap; }
.post .foot { margin-top: 12px; display: flex; gap: 10px; align-items: center; }

/* ===== 表单 ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--text-mute); margin-top: 5px; }
.authcard { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); }
.tabs { display: flex; gap: 6px; background: var(--bg-soft); padding: 5px; border-radius: 12px; margin-bottom: 22px; }
.tabs button { flex: 1; border: none; background: transparent; color: var(--text-dim); font-weight: 700; padding: 10px; border-radius: 9px; font-size: 14px; }
.tabs button.active { background: var(--grad); color: #fff; }
.demo-line { margin-top: 16px; font-size: 12px; color: var(--text-mute); text-align: center; }
.demo-line a { color: var(--brand-2); font-weight: 700; cursor: pointer; }

/* ===== 空态 ===== */
.empty { text-align: center; color: var(--text-mute); padding: 50px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ===== Toast ===== */
#toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px); background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 12px 20px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 999; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--danger); }
#toast.ok { border-color: var(--ok); }

/* ===== 详情页 ===== */
.detail-cover { height: 200px; display: grid; place-items: center; font-size: 96px; background: linear-gradient(135deg, #1f2440, #2a2150); border-radius: var(--radius); }
.chapter { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 10px; }
.chapter .idx { width: 28px; height: 28px; border-radius: 8px; background: var(--grad); display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; }
.chapter .dur { margin-left: auto; color: var(--text-mute); font-size: 13px; }
.kv { display: flex; gap: 8px; font-size: 13px; color: var(--text-dim); margin: 4px 0; }
.kv b { color: var(--text); }

/* ===== v2：发现 / 版块 / 进度 / 评论 / 学习页 ===== */
.card-top { display: flex; align-items: center; justify-content: space-between; }
.cat-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #b9a8ff; background: rgba(124,92,255,.14); border: 1px solid rgba(124,92,255,.28); }
.card-stats { color: var(--text-mute); font-size: 12px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.board-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--text-dim); background: var(--panel-2); border: 1px solid var(--line); }
.post h3 a:hover, .post .head .name:hover { color: var(--brand-2); }
.post.compact { padding: 14px 16px; }
.btn.ghost.sm.liked { color: var(--brand-2); border-color: rgba(255,92,168,.5); }

/* 工具栏：搜索 + 排序 + 分类 */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search input { padding-left: 36px; }
.toolbar .search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-mute); font-size: 14px; }
.toolbar select { width: auto; min-width: 130px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text-dim); background: var(--panel); border: 1px solid var(--line); transition: .15s; }
.chip:hover { color: var(--text); background: var(--panel-2); }
.chip.active { color: #fff; background: var(--grad); border-color: transparent; }

/* 进度条 */
.progress { height: 8px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line); overflow: hidden; margin: 8px 0 4px; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--grad); transition: width .3s; }
.progress-label { font-size: 12px; color: var(--text-mute); }

/* 面包屑 */
.breadcrumb { color: var(--text-dim); font-size: 14px; margin-bottom: 4px; }
.breadcrumb a:hover { color: var(--brand-2); }

/* 学习页 */
.learn-layout { display: grid; grid-template-columns: 290px 1fr; gap: 18px; margin-top: 18px; align-items: start; }
.learn-side { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 78px; }
.learn-side h3 { font-size: 15px; margin-bottom: 12px; }
.chapter-item { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 10px; border: 1px solid transparent; font-size: 13px; color: var(--text-dim); transition: .15s; }
.chapter-item:hover { background: var(--bg-soft); }
.chapter-item.active { background: var(--panel-2); border-color: var(--brand); color: var(--text); }
.chapter-item .state { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; }
.chapter-item.done .state { background: rgba(43,214,123,.16); border-color: var(--ok); color: var(--ok); }
.chapter-item .ttl { flex: 1; line-height: 1.35; }
.learn-main { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; min-height: 320px; }
.learn-stage { height: 190px; border-radius: 12px; background: linear-gradient(135deg, #1f2440, #2a2150); display: grid; place-items: center; font-size: 60px; margin-bottom: 18px; }
.learn-stage .hint { font-size: 13px; color: var(--text-dim); text-align: center; }
.learn-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.discussion { margin-top: 26px; }
.discussion .post { padding: 13px 15px; }
.discussion .post + .post { margin-top: 10px; }

/* 评论 */
.comment { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: none; }
.comment .av { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; }
.comment .cbody { flex: 1; }
.comment .chead { display: flex; align-items: center; gap: 9px; font-size: 13px; margin-bottom: 3px; }
.comment .chead b { font-weight: 700; }
.comment .chead .time { color: var(--text-mute); font-size: 12px; }
.comment .ctext { color: var(--text-dim); font-size: 14px; white-space: pre-wrap; }

/* 平台概览 / 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; }
.stat .k { color: var(--text-dim); font-size: 12px; }
.stat .v { font-size: 23px; font-weight: 800; margin-top: 3px; color: #ffd479; }

/* 章节编辑行 */
.chapter-edit { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.chapter-edit input { flex: 1; min-width: 0; }
.chapter-edit input.ct { flex: 1.7; }
.chapter-edit input.cv { flex: 1.2; }
.chapter-edit input.dur { flex: 0 0 78px; width: 78px; }
.chapter-edit .rm { flex: none; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--danger); font-size: 16px; }
.field-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.field-head label { margin: 0; }

/* 提示条 */
.notice-bar { background: rgba(255,176,32,.09); border: 1px solid rgba(255,176,32,.3); color: var(--warn); border-radius: 11px; padding: 11px 14px; font-size: 13px; margin-bottom: 16px; }
.empty.small { padding: 24px 16px; }

/* ===== v3：商品类型 / 收藏 / 分享 / 后台 / 订单 / 视频 ===== */
.card-link { display: flex; flex-direction: column; flex: 1; color: inherit; }
.card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--bg-soft); }
.type-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #b9a8ff; background: rgba(124,92,255,.14); border: 1px solid rgba(124,92,255,.28); white-space: nowrap; }
.type-tag.res { color: #7ee0c0; background: rgba(43,214,123,.12); border-color: rgba(43,214,123,.3); }
.tag.pin { background: rgba(255,176,32,.14); color: var(--warn); }
.tag.feat { background: rgba(255,92,168,.14); color: var(--brand-2); }
.btn.ghost.sm.faved { color: #ffd479; border-color: rgba(255,212,121,.55); }
.btn.ghost.sm.favbtn { min-width: 56px; }
.stars { color: #ffd479; letter-spacing: 1px; font-size: 13px; }
.stars .off { color: var(--line); }

/* 通用弹窗 */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.68); z-index: 200; align-items: flex-start; justify-content: center; padding: 36px 16px; overflow: auto; }
.modal-card { width: 100%; max-width: 640px; position: relative; }
.modal-x { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--text-dim); font-size: 20px; }
.share-head { display: flex; gap: 14px; align-items: center; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.share-cover { width: 62px; height: 62px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 32px; background: linear-gradient(135deg,#1f2440,#2a2150); }
.share-url { color: var(--brand-2); font-size: 11px; word-break: break-all; line-height: 1.4; }
.share-qr { flex: none; text-align: center; font-size: 10px; color: var(--text-mute); }
.share-qr svg { display: block; border-radius: 6px; margin-bottom: 3px; }
.share-channels { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.share-block { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; margin-bottom: 10px; }
.share-block .field-head label { color: var(--text-dim); }
.share-block pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13px; color: var(--text); line-height: 1.6; }
.share-sdk { margin-top: 14px; padding: 12px 14px; border-radius: 11px; border: 1px dashed var(--line); font-size: 12px; color: var(--text-dim); line-height: 1.8; }
.share-sdk code { color: #b9a8ff; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* 后台多面板 */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; background: var(--bg-soft); padding: 6px; border-radius: 12px; margin-bottom: 20px; }
.admin-tabs button { border: none; background: transparent; color: var(--text-dim); font-weight: 700; font-size: 13px; padding: 9px 14px; border-radius: 9px; }
.admin-tabs button:hover { color: var(--text); }
.admin-tabs button.active { background: var(--grad); color: #fff; }
.admin-pane { display: none; }
.admin-pane.active { display: block; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--text-dim); font-size: 12px; background: var(--bg-soft); white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table td .mini { font-size: 11px; color: var(--text-mute); }
.table .ops { display: flex; gap: 5px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: 92px; padding: 7px 9px; font-size: 12px; }
.inline-form input[type=number] { max-width: 92px; }

/* 上传 / 附件 / 视频 */
.upload-row, .attach-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; font-size: 13px; }
.upload-row .grow, .attach-row .grow { flex: 1; min-width: 140px; }
.upload-row input[type=file] { font-size: 12px; padding: 6px; }
.file-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text-dim); }
.chapter-edit .trial { flex: none; display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-mute); white-space: nowrap; }
.chapter-edit .trial input { width: auto; }
.chapter-edit .upbtn { flex: none; padding: 5px 8px; font-size: 11px; white-space: nowrap; }
.upload-row input.an, .upload-row input.au { width: auto; }
.upload-row .rm { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--danger); }
.attach-edit .file-pill { white-space: nowrap; }
video.player { width: 100%; max-height: 420px; border-radius: 12px; background: #000; display: block; }
.video-stage { background: #000; border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.att-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 9px; }
.att-item .ico { font-size: 22px; }
.att-item .nm { flex: 1; min-width: 0; word-break: break-all; font-size: 14px; }

/* 评价 */
.rating-pick { display: flex; gap: 4px; font-size: 24px; cursor: pointer; user-select: none; }
.rating-pick span { color: var(--line); transition: .12s; }
.rating-pick span.on { color: #ffd479; }
.review-item { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: none; }

/* 收银台 */
.checkout-box { display: grid; grid-template-columns: 1fr 260px; gap: 18px; align-items: start; }
.checkout-qr { background: #fff; border-radius: 14px; padding: 16px; text-align: center; color: #0b0d17; }
.checkout-qr .amt { font-size: 26px; font-weight: 800; color: #1677ff; margin: 10px 0 4px; }
.checkout-qr .fake { width: 168px; height: 168px; margin: 8px auto; border: 2px dashed #bbb; border-radius: 10px; display: grid; place-items: center; font-size: 13px; color: #888; text-align: center; line-height: 1.6; padding: 12px; }
.checkout-qr .tip { font-size: 11px; color: #666; margin-top: 8px; line-height: 1.5; }
.pay-note { background: rgba(255,176,32,.09); border: 1px solid rgba(255,176,32,.3); color: var(--warn); border-radius: 11px; padding: 12px 14px; font-size: 13px; line-height: 1.7; margin-bottom: 16px; }
.order-row { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.order-row .cover { width: 48px; height: 48px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 24px; background: var(--panel-2); }
.order-row .info { flex: 1; min-width: 0; }
.doc-line { color: var(--text-dim); font-size: 13px; line-height: 1.8; }
.doc-line b { color: var(--text); }

/* ===== v4：通知 / 搜索 / 积分 / 图表 / 笔记 / 证书 ===== */
.global-search { display: flex; align-items: center; gap: 0; flex: none; }
.global-search input { width: 190px; padding: 8px 12px; font-size: 13px; border-radius: 10px 0 0 10px; border-right: none; }
.global-search button { flex: none; width: 38px; height: 37px; border: 1px solid var(--line); border-left: none; border-radius: 0 10px 10px 0; background: var(--bg-soft); color: var(--text-dim); font-size: 14px; cursor: pointer; }
.global-search button:hover { color: var(--text); }
.bell { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; font-size: 18px; background: var(--panel); border: 1px solid var(--line); flex: none; }
.bell:hover { background: var(--panel-2); }
.bell-dot { position: absolute; top: -5px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--brand-2); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.mention { color: #a98bff; background: rgba(124,92,255,.13); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.lv-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #ffd479; background: rgba(255,212,121,.12); border: 1px solid rgba(255,212,121,.3); white-space: nowrap; }
.chart-legends { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.chart-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-svg { width: 100%; height: auto; display: block; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: flex; align-items: center; gap: 11px; font-size: 13px; }
.bar-label { width: 106px; flex: none; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 9px; border-radius: 6px; background: var(--bg-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; min-width: 2px; }
.bar-row b { width: 30px; text-align: right; font-size: 12px; }
.notif-item { display: flex; gap: 13px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; position: relative; }
.notif-item.unread { border-color: rgba(124,92,255,.55); background: linear-gradient(90deg, rgba(124,92,255,.10), var(--panel) 40%); }
.notif-item.unread::after { content: ''; position: absolute; top: 18px; right: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.notif-ico { width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; font-size: 18px; }
.notif-body { flex: 1; min-width: 0; }
.notif-body h4 { font-size: 14px; margin-bottom: 3px; }
.notif-body p { color: var(--text-dim); font-size: 13px; line-height: 1.6; word-break: break-word; }
.profile-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; background: linear-gradient(120deg, rgba(124,92,255,.16), rgba(255,92,168,.08)); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.profile-avatar { width: 76px; height: 76px; flex: none; border-radius: 20px; display: grid; place-items: center; font-size: 38px; background: var(--panel-2); border: 1px solid var(--line); }
.level-track { height: 8px; border-radius: 5px; background: var(--bg-soft); overflow: hidden; margin: 8px 0 4px; }
.level-fill { height: 100%; background: var(--grad); border-radius: 5px; }
.stat-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat-mini .box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.stat-mini .box b { display: block; font-size: 21px; }
.stat-mini .box span { color: var(--text-mute); font-size: 12px; }
.note-editor textarea { min-height: 96px; }
.note-item { border-left: 3px solid var(--brand); padding: 10px 14px; background: var(--bg-soft); border-radius: 0 10px 10px 0; margin-bottom: 9px; }
.checkin-box { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.checkin-days { display: flex; gap: 5px; }
.checkin-days i { width: 15px; height: 15px; border-radius: 4px; background: var(--bg-soft); border: 1px solid var(--line); font-style: normal; }
.checkin-days i.on { background: var(--ok); border-color: var(--ok); }
.reply-item { margin-left: 28px; border-left: 2px solid var(--line); padding: 8px 0 8px 14px; }
.reply-to { color: var(--brand); font-size: 12px; font-weight: 700; }
.leaderboard-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.leaderboard-row:last-child { border-bottom: none; }
.rank-chip { width: 28px; height: 28px; flex: none; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--panel-2); color: var(--text-dim); }
.rank-chip.top1 { background: #ffd479; color: #3a2a00; }
.rank-chip.top2 { background: #c8d0e0; color: #232a3a; }
.rank-chip.top3 { background: #d9a077; color: #3a2010; }
.audit-line { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.audit-line:last-child { border-bottom: none; }
.audit-line code { color: #a98bff; background: rgba(124,92,255,.1); border-radius: 4px; padding: 1px 6px; font-size: 12px; }
.search-group h3 { font-size: 15px; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.cert-frame { background: linear-gradient(135deg, #fdfbf7 0%, #f3eee3 100%); color: #2b2418; border: 12px solid #e3d6b8; outline: 2px solid #b99b60; outline-offset: -22px; border-radius: 8px; padding: 54px 44px; text-align: center; max-width: 780px; margin: 0 auto; }
.cert-frame .seal { font-size: 42px; }
.cert-frame h1 { font-size: 34px; letter-spacing: 6px; margin: 10px 0 6px; }
.cert-frame .sub-en { letter-spacing: 3px; font-size: 12px; color: #8a7850; text-transform: uppercase; }
.cert-frame .holder { font-size: 30px; font-weight: 800; border-bottom: 1px solid #b8a77e; display: inline-block; padding: 0 26px 8px; margin: 26px 0 12px; }
.cert-frame .course { font-size: 19px; margin: 6px 0 30px; }
.cert-frame .foot { display: flex; justify-content: space-between; font-size: 12px; color: #7a6a45; border-top: 1px solid #d8c9a6; padding-top: 16px; }
@media print {
  body { background: #fff; }
  .topbar, .no-print { display: none !important; }
  .wrap { padding: 0; }
  .cert-frame { border: 14px solid #e3d6b8; box-shadow: none; }
}
/* ===== 响应式 ===== */
@media (max-width: 1080px) { .global-search input { width: 130px; } }
@media (max-width: 900px) {
  .global-search { display: none; }
  .checkout-box { grid-template-columns: 1fr; }
  .learn-layout { grid-template-columns: 1fr; }
  .learn-side { position: static; }
}
@media (max-width: 720px) {
  .hero h1 { font-size: 32px; }
  .nav { display: none; }
  .wrap { padding: 20px 16px 70px; }
  .toolbar .search { min-width: 100%; }
}

/* ===================== v6：按钮状态 / 移动端导航 ===================== */
.spinner {
  width: 13px; height: 13px; flex: none; display: inline-block;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: wb-spin .7s linear infinite;
}
.btn.ghost .spinner { border-color: var(--line); border-top-color: var(--text); }
@keyframes wb-spin { to { transform: rotate(360deg); } }
.btn.is-busy { opacity: .78; cursor: progress; transform: none; }
.btn.is-busy:hover { transform: none; }

/* 移动端元素：桌面隐藏 */
.mobile-search-btn, .ub-mobile-only, .user-menu, .tabbar { display: none; }
.userbox { position: relative; }
.avatar-btn {
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-size: 17px; cursor: pointer; place-items: center;
}
.avatar-btn:hover { border-color: var(--accent, #7c5cff); }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 70;
  width: 190px; padding: 8px; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
}
.user-menu .um-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13px;
}
.user-menu .um-head span { margin-left: auto; color: var(--text-mute); font-size: 11px; }
.user-menu a, .user-menu button {
  display: block; width: 100%; text-align: left; padding: 10px 12px;
  border: none; background: none; color: var(--text); font-size: 13px;
  border-radius: 9px; cursor: pointer; font-weight: 600;
}
.user-menu a:hover, .user-menu button:hover { background: var(--panel-2); }
/* v35：用户区收敛 —— 头像+昵称即下拉触发器，桌面/移动统一 */
.user-menu.open { display: flex; }
.ub-trigger {
  display: flex; align-items: center; gap: 9px;
  background: none; border: none; cursor: pointer; color: var(--text);
  padding: 4px 8px; border-radius: 10px; font-family: inherit;
}
.ub-trigger:hover { background: var(--panel-2); }
.ub-trigger .avatar {
  width: 34px; height: 34px; font-size: 17px; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 50%;
}
.ub-trigger .ub-name-only { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.ub-trigger .ub-name-only b { font-size: 13px; font-weight: 700; }
.ub-trigger .ub-name-only i { font-style: normal; color: var(--text-mute); font-size: 11px; }
.ub-trigger .caret { color: var(--text-mute); font-size: 11px; }
.user-menu .um-group-label {
  padding: 8px 12px 2px; font-size: 11px; color: var(--text-mute);
  font-weight: 700; letter-spacing: .06em;
}

@media (max-width: 900px) {
  .mobile-search-btn {
    display: grid; place-items: center; flex: none;
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--panel); border: 1px solid var(--line); font-size: 15px;
  }
  .mobile-search-btn:hover { background: var(--panel-2); }
}
@media (max-width: 720px) {
  /* v16/M3：iOS Safari 对字号 <16px 的输入框聚焦时会自动放大整个页面，
     把固定底栏和按钮推出视口。移动端统一 16px，覆盖 .inline-form / .global-search 的小字号 */
  input, textarea, select { font-size: 16px !important; }

  /* 顶栏：压紧间距、精简用户区，避免 210px 的 userbox 撑宽 layout viewport */
  .topbar { gap: 10px; padding: 10px 12px; overflow: visible; }
  .logo { font-size: 13px; gap: 6px; white-space: nowrap; flex: none; }
  .logo .mark { width: 28px; height: 28px; font-size: 15px; flex: none; }
  .topbar .spacer { min-width: 0; }
  .ub-desktop-only { display: none !important; }
  .ub-mobile-only { display: grid; }
  /* 手机端触发器只留头像+箭头，昵称收进菜单 */
  .ub-trigger .ub-name-only { display: none; }
  .ub-login { font-size: 12px; padding: 7px 10px; white-space: nowrap; flex: none; }
  .user-menu.open { display: flex; }
  .bell { width: 38px; height: 38px; }

  /* 固定底部导航：5 入口，点击目标 ≥ 52px，留 iPhone 安全区 */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(20,23,39,.96); border-top: 1px solid var(--line);
    backdrop-filter: blur(12px);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1; min-width: 0; min-height: 52px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--text-mute); font-size: 11px; font-weight: 600;
    border-radius: 10px; text-align: center;
  }
  .tabbar a .ti { font-size: 20px; line-height: 1.15; }
  .tabbar a:hover { color: var(--text); background: var(--panel); }
  .tabbar a.active { color: #ffd479; background: rgba(124,92,255,.16); }
  .wrap { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* 手机端表格横向可滚，不挤成一团 */
  .card table, .table-wrap { overflow-x: auto; }
}
@media print {
  .tabbar, .mobile-search-btn, .user-menu, .avatar-btn { display: none !important; }
}
/* v21/H1：邮箱注册表单（flex-wrap + min-width:0，375px 视口不撑宽） */
.inline-field { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.inline-field input { flex: 1 1 160px; min-width: 0; }
.inline-field .btn { flex: none; white-space: nowrap; }
.role-row { display: flex; gap: 10px; flex-wrap: wrap; }
.role-opt {
  flex: 1 1 140px; min-width: 0; display: flex; align-items: center; gap: 7px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 13px; color: var(--text-dim); cursor: pointer;
}
.role-opt:hover { background: var(--panel-2); }
.role-opt:has(input:checked) { border-color: var(--brand-2); color: var(--text); background: rgba(124,92,255,.12); }
.role-opt input { accent-color: var(--brand-2); flex: none; }
.demo-line .hint { margin-top: 8px; }

/* v16/H2：搜索命中高亮（暗色主题） */
mark { background: rgba(255,176,32,.24); color: #ffd479; padding: 1px 2px; border-radius: 4px; }
