/* ============================================================
   游戏项目网盘论坛 - 前台样式（浅色卡片风）
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e7ebf3;
  --text: #172033;
  --text-2: #47536b;
  --muted: #8a94a8;
  --primary: #3b82f6;
  --primary-strong: #2563eb;
  --primary-soft: rgba(59,130,246,.10);
  --green: #16a34a;
  --green-bright: #22c55e;
  --green-strong: #15803d;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 6px 20px rgba(16,24,40,.08);
  --shadow-lg: 0 12px 36px rgba(16,24,40,.14);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ========== AI 搜索面板 ========== */
.ai-bar {
  position: fixed; top: 10px; right: 10px; width: 380px;
  max-width: calc(100vw - 260px);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); z-index: 9999;
  transition: max-height .3s; overflow: hidden; padding: 0;
}
.ai-bar.open    { max-height: 480px; }
.ai-bar.closed  { max-height: 42px; }
.ai-bar-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; cursor: pointer; user-select: none;
  font-size: 13px; color: var(--muted); background: var(--bg);
  border-radius: 12px 12px 0 0; white-space: nowrap;
}
.ai-bar-header:hover { color: var(--primary); }
.ai-bar-header .arrow { transition: transform .25s; font-size: 10px; color: var(--primary); }
.ai-bar.open .arrow { transform: rotate(90deg); }
.ai-bar-tip { margin-left: auto; font-size: 11px; color: var(--muted); }
.ai-bar-body { padding: 8px 14px 12px; display: flex; flex-direction: column; gap: 8px; }
#aiChat {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 320px; overflow-y: auto; font-size: 13px;
  padding-right: 4px; scroll-behavior: smooth;
}
.ai-msg {
  padding: 8px 12px; border-radius: 10px; max-width: 95%; line-height: 1.55;
  word-break: break-word; animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:.5; transform: translateY(4px);} to { opacity:1; transform: none;} }
.ai-msg.user {
  background: var(--primary); color: #fff; align-self: flex-end;
  box-shadow: 0 1px 4px rgba(59,130,246,.25);
}
.ai-msg.bot { background: #f1f5f9; color: #334155; align-self: flex-start; border: 1px solid var(--border); }
.ai-msg.bot a { color: var(--primary); }
.ai-empty-hint { color: var(--muted); font-size: 12px; text-align: center; padding: 20px 0; line-height: 1.6; }

.ai-input-row { display: flex; gap: 8px; margin-top: 2px; }
.ai-input-row input {
  flex: 1; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 13px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.ai-input-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.ai-input-row input::placeholder { color: #94a3b8; }
.ai-input-row button {
  padding: 8px 18px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; cursor: pointer; font-size: 13px;
  font-weight: 600; transition: all .15s; white-space: nowrap;
}
.ai-input-row button:hover { background: var(--primary-strong); transform: translateY(-1px); }

/* 加载动画（双环） */
.uv-loading { display: flex; align-items: center; gap: 8px; }
.uv-spinner {
  width: 26px; height: 26px; display: grid; border: 3.5px solid #0000;
  border-radius: 50%; border-color: var(--border) #0000;
  animation: uvSpin 1s infinite linear;
}
.uv-spinner::before, .uv-spinner::after {
  content: ""; grid-area: 1/1; margin: 1.8px; border: inherit; border-radius: 50%;
}
.uv-spinner::before { border-color: var(--primary) #0000; animation: inherit; animation-duration: .5s; animation-direction: reverse; }
.uv-spinner::after { margin: 6.5px; }
@keyframes uvSpin { 100% { transform: rotate(1turn);} }

/* ========== 主布局 ========== */
.main { display: flex; flex: 1; overflow: hidden; }

/* 左侧 */
.sidebar {
  width: 300px; min-width: 240px; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 1px 0 4px rgba(0,0,0,.02);
}
.sidebar-title {
  padding: 14px 20px; font-size: 14px; font-weight: 700;
  border-bottom: 1px solid var(--border); color: var(--text);
  display: flex; align-items: center; gap: 8px; background: #fafbfc;
}
.sidebar-search { padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.sidebar-search input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 13px; outline: none;
}
.sidebar-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.game-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.sidebar-loading, .load-error { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }
.load-error { color: var(--red); }

.game-item { cursor: pointer; user-select: none; }
.game-name {
  padding: 10px 16px; display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; color: #334155;
  transition: all .15s; border-left: 3px solid transparent;
  margin: 0 4px; border-radius: 8px;
}
.game-name:hover { background: #f1f5f9; color: var(--text); }
.game-name .game-name-text {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-item.active > .game-name {
  background: #eff6ff; border-left-color: var(--primary); color: #1e40af; font-weight: 600;
}
.game-icon { border-radius: 4px; flex-shrink: 0; }
.game-name .count {
  margin-left: auto; font-size: 11px; color: #94a3b8;
  background: #f1f5f9; padding: 2px 8px; border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
/* 展开时：胶囊吸到右边，数量徽章紧跟其后（仅当有官网时，没官网徽章保持吸右） */
.game-item.active:has(.gs-website) .count { margin-left: 0; }
.game-item.active .gs-website { margin-left: auto; }
.script-list { display: none; }
.game-item.active .script-list { display: block; }
.script-item {
  padding: 8px 16px 8px 44px; font-size: 13px; cursor: pointer;
  transition: all .15s; color: var(--muted);
  border-left: 3px solid transparent; margin: 0 4px; border-radius: 8px;
}
.script-item:hover { background: #f8fafc; color: #334155; }
.script-item.active {
  background: #f0fdf4; border-left-color: var(--green-bright); color: #166534; font-weight: 600;
}

/* 右侧 */
.content { flex: 1; overflow-y: auto; padding: 28px 36px; background: var(--bg); }
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: #94a3b8; gap: 16px;
}
.empty-state .big-icon { font-size: 64px; opacity: .3; }
.empty-state .hint { font-size: 16px; color: var(--text-2); }

/* ========== 热门排行看板 ========== */
.hot-widget {
  position: fixed; right: 16px; bottom: 16px; width: 300px; z-index: 9990;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.hot-widget-header {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 700; color: var(--text); background: var(--bg);
}
.hot-widget-header .hw-sub { font-size: 11px; color: #94a3b8; font-weight: 400; }
.hot-widget-header .hw-arrow { margin-left: auto; font-size: 10px; color: var(--primary); transition: transform .25s; }
.hot-widget.collapsed .hw-arrow { transform: rotate(-90deg); }
.hot-widget-body { max-height: 360px; overflow-y: auto; padding: 8px; }
.hot-widget.collapsed .hot-widget-body { display: none; }
.hot-item { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px; cursor: pointer; transition: background .12s; }
.hot-item:hover { background: #f1f5f9; }
.hot-rank {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; background: #cbd5e1;
}
.hot-item:nth-child(1) .hot-rank { background: #f59e0b; }
.hot-item:nth-child(2) .hot-rank { background: #94a3b8; }
.hot-item:nth-child(3) .hot-rank { background: #c08a5a; }
.hot-info { flex: 1; min-width: 0; }
.hot-name {
  font-size: 12.5px; font-weight: 600; color: #334155;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.4;
}
.hot-game { font-size: 10.5px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.hot-bar-wrap { height: 6px; background: #f1f5f9; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.hot-bar { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--primary), #7c3aed); width: 0; transition: width .5s ease; }
.hot-empty { padding: 18px; text-align: center; color: #94a3b8; font-size: 12px; }

/* ========== 脚本详情 ========== */
.detail-section { display: none; }
.detail-section.visible { display: block; max-width: 780px; }
.breadcrumb {
  font-size: 12px; color: #94a3b8; margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.breadcrumb span { color: var(--text-2); }
.crumb-manage-btn {
  flex: none; padding: 3px 12px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--surface); color: var(--primary); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.crumb-manage-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.script-title { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 6px; }
.script-game-tag {
  display: inline-block; font-size: 12px; padding: 3px 12px;
  background: var(--primary-soft); color: var(--primary); font-weight: 500;
  border-radius: 12px; margin-bottom: 20px;
}

/* 下载区 */
.download-area { margin-bottom: 18px; }
.download-area.primary-action {
  position: sticky; top: 8px; z-index: 3; padding: 12px;
  background: rgba(244,246,251,.94); border: 1px solid #dbeafe;
  border-radius: 12px; backdrop-filter: blur(8px);
}
.download-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.download-row + .download-row { margin-top: 10px; }
.btn-download {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 26px; background: var(--green-bright); color: #fff;
  border: 2px solid var(--green-bright); border-radius: 50px; font-size: 15px; font-weight: 700;
  cursor: pointer; text-decoration: none; overflow: hidden;
  transition: all .2s ease; box-shadow: 0 2px 8px rgba(34,197,94,.3);
}
.btn-download::before {
  content: ""; position: absolute; top: 0; right: 0; width: 46px; height: 100%;
  border-radius: 50px; background: var(--green-strong); transition: all .5s ease;
}
.btn-download .btn-label, .btn-download svg { position: relative; z-index: 1; }
.btn-download svg {
  fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; transform: translateX(-3px); transition: transform .5s ease;
}
.btn-download:hover::before { width: 100%; }
.btn-download:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(34,197,94,.35); }
.btn-download:hover svg { transform: translateX(0); }
.btn-download.btn-backup { background: #64748b; border-color: #64748b; box-shadow: 0 2px 8px rgba(100,116,139,.3); }
.btn-download.btn-backup::before { background: #475569; }
.btn-download.btn-backup:hover { box-shadow: 0 4px 14px rgba(100,116,139,.35); }
.btn-download.disabled {
  background: var(--border); border-color: var(--border); color: #94a3b8;
  cursor: not-allowed; pointer-events: none; box-shadow: none;
}
.btn-download.disabled::before { background: transparent; }
.btn-download.disabled svg { stroke: #cbd5e1; }

.download-pwd {
  display: none; align-items: center; gap: 8px;
  padding: 9px 16px; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; font-size: 13px;
}
.download-pwd.visible { display: flex; }
.download-pwd .pwd-label { color: #92400e; font-weight: 500; }
.download-pwd .pwd-value {
  color: var(--amber); font-family: 'SF Mono', Consolas, 'Cascadia Code', monospace;
  font-weight: 700; font-size: 14px; user-select: all; cursor: text; letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
}
.download-pwd .pwd-copy {
  margin-left: 4px; padding: 4px 10px;
  border: 1px solid #fcd34d; border-radius: 6px;
  background: #fff; color: #92400e; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.download-pwd .pwd-copy:hover { background: #f59e0b; border-color: #f59e0b; color: #fff; }

/* 卡片 */
.desc-card, .faq-card, .changelog-card, .feedback-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.desc-card h3, .faq-card h3, .changelog-card h3, .feedback-card h3 {
  font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px; letter-spacing: .01em;
}
.desc-text { font-size: 14px; color: var(--text-2); line-height: 1.8; white-space: pre-wrap; word-break: break-word; }

/* FAQ */
.faq-item { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: #fff; overflow: hidden; }
.faq-q {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  cursor: pointer; font-size: 14px; user-select: none;
  color: var(--text); font-weight: 600; transition: background .15s;
}
.faq-q:hover { background: #f1f5f9; }
.faq-q.open { background: #eff6ff; color: #1e40af; }
.faq-q .faq-arrow { transition: transform .2s; font-size: 10px; color: var(--primary); }
.faq-q.open .faq-arrow { transform: rotate(90deg); }
.faq-a {
  max-height: 0; overflow: hidden; padding: 0 14px;
  font-size: 13px; color: var(--text-2); line-height: 1.7;
  transition: max-height .25s ease;
}
.faq-a.open { max-height: 4000px; padding: 0 14px 12px; white-space: pre-wrap; }
/* 富文本答案（管理面板可视化编辑，服务端已净化） */
.faq-a img { max-width: 100%; border-radius: 6px; margin: 6px 0; }
.faq-a a { color: var(--primary); }
.faq-a ul, .faq-a ol { margin: 4px 0 8px 20px; }

/* 版本更新 */
.changelog-item { margin-bottom: 4px; }
/* 游戏官网（脚本顶部，后台游戏编辑可配，留空不显示） */
.game-website {
  margin: 0 0 12px; padding: 8px 12px; border-radius: 8px;
  background: var(--primary-soft, #eff6ff); border: 1px solid #dbeafe;
  font-size: 13px; color: var(--text-2);
}
.game-website a { color: var(--primary); font-weight: 500; word-break: break-all; }
/* 游戏标题行官网胶囊（分栏+看板通用，仅展开时显示） */
.gs-website {
  display: none; align-items: center; gap: 4px;
  margin: 0 4px 0 auto; padding: 2px 10px; border-radius: 999px;
  background: #f8fafc; border: 1px solid #e2e8f0;
  font-size: 12px; color: #64748b; font-weight: 400;
  max-width: 40%; box-sizing: border-box;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: all .15s; flex: none; min-width: 0;
}
.gs-website:hover { color: var(--primary); border-color: #bfdbfe; background: #eff6ff; }
.game-item.active .gs-website { display: inline-flex; }
.board-game.open .gs-website { display: inline-flex; }
.changelog-ver {
  padding: 10px 16px; background: #f8fafc; border-radius: 8px;
  cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 10px;
  user-select: none; transition: all .15s; color: #334155; font-weight: 500;
  border: 1px solid transparent;
}
.changelog-ver:hover { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.changelog-ver.open { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.changelog-ver .cl-arrow { transition: transform .25s; font-size: 9px; color: #f59e0b; }
.changelog-ver.open .cl-arrow { transform: rotate(90deg); }
.cl-version {
  color: var(--amber); font-weight: 700; font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px; padding: 2px 8px; background: #fef3c7; border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.cl-date { margin-left: auto; font-size: 12px; color: #94a3b8; font-weight: 400; font-variant-numeric: tabular-nums; }
.changelog-body {
  padding: 10px 16px 12px 34px; font-size: 14px; color: var(--text-2);
  display: none; line-height: 1.7; white-space: pre-wrap;
}
.changelog-body.open { display: block; }
.cl-empty, .list-empty { padding: 8px 16px; font-size: 13px; color: #94a3b8; }

/* 反馈 */
.feedback-form { display: flex; gap: 10px; margin-bottom: 12px; }
.feedback-form textarea {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 13px; resize: vertical;
  min-height: 42px; font-family: inherit; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.feedback-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.feedback-form textarea::placeholder { color: #94a3b8; }
.feedback-form button {
  padding: 8px 22px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; cursor: pointer; font-size: 13px;
  font-weight: 600; align-self: flex-end; transition: all .15s; white-space: nowrap;
}
.feedback-form button:hover { background: var(--primary-strong); transform: translateY(-1px); }

/* Toast */
.feedback-toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 99999;
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 16px; box-shadow: var(--shadow-lg);
  transform: translateX(130%); transition: transform .3s ease;
  font-size: 14px; color: #334155; font-weight: 500; max-width: 320px;
}
.feedback-toast.show { transform: translateX(0); }
.feedback-toast-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px;
}
.feedback-toast.success .feedback-toast-icon { background: var(--green); }
.feedback-toast.error .feedback-toast-icon { background: var(--red); }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ========== 移动端 ========== */
.menu-toggle, .sidebar-mask { display: none; }

@media (max-width: 760px) {
  body { height: auto; min-height: 100vh; overflow: auto; }
  .main { flex-direction: column; overflow: visible; }

  /* 顶栏汉堡钮 */
  .menu-toggle {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 10002;
    width: 100%; padding: 12px 14px;
    border: none; border-bottom: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    font-size: 15px; font-weight: 700; cursor: pointer;
    text-align: left; box-shadow: var(--shadow-sm);
  }
  .menu-toggle span { font-family: inherit; }

  /* 侧栏改为抽屉 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 10003;
    width: min(82vw, 320px); max-height: none;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--border); border-bottom: 0;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-mask {
    display: block; position: fixed; inset: 0; z-index: 10001;
    background: rgba(15,23,42,.45);
    opacity: 0; pointer-events: none; transition: opacity .25s ease;
  }
  body.sidebar-open .sidebar-mask { opacity: 1; pointer-events: auto; }
  body.sidebar-open { overflow: hidden; }

  .game-list { min-height: 120px; }
  .content { min-height: 62vh; padding: 18px 14px; overflow-y: visible; }
  .detail-section.visible { max-width: none; }

  /* AI 面板全宽吸顶，不再遮挡内容 */
  .ai-bar { position: sticky; top: 0; right: auto; width: 100%; max-width: none; border-radius: 0; }
  .ai-bar-header { border-radius: 0; }

  /* 热门看板贴底全宽，不与 Toast 打架 */
  .hot-widget { width: calc(100vw - 28px); right: 14px; bottom: 14px; }
  .feedback-toast { right: 14px; bottom: auto; top: 14px; }

  .download-area.primary-action { position: static; }
  .download-row { flex-direction: column; align-items: stretch; }
  .btn-download { justify-content: center; width: 100%; min-height: 48px; }
  .download-pwd { justify-content: space-between; }
  .feedback-form { flex-direction: column; }
  .feedback-form button { align-self: stretch; min-height: 44px; }
  .script-title { font-size: 21px; }

  /* 触控友好 */
  .script-item, .game-name { padding-top: 12px; padding-bottom: 12px; }
  .faq-q, .changelog-ver { padding-top: 14px; padding-bottom: 14px; }
}

/* ========== 前端通用按钮（与后台同款风格） ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: all .15s; white-space: nowrap;
  background: var(--primary); color: #fff; text-decoration: none; font-family: inherit;
}
.btn:hover { background: var(--primary-strong); text-decoration: none; transform: translateY(-1px); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-green { background: var(--green); } .btn-green:hover { background: var(--green-strong); }
.btn-gray { background: #64748b; } .btn-gray:hover { background: #475569; }
.btn-red { background: var(--red); } .btn-red:hover { background: #b91c1c; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 600; background: #f1f5f9; color: var(--text-2);
}
.badge.green { background: #dcfce7; color: #166534; }

/* 游戏名右侧 ＋ 注册钮 */
.game-add {
  margin-left: 4px; width: 22px; height: 22px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 6px;
  background: #f8fafc; color: var(--primary); font-size: 14px; font-weight: 700;
  cursor: pointer; line-height: 1; transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.game-add:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========== 模态框 ========== */
.modal-mask {
  position: fixed; inset: 0; z-index: 99990;
  background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
/* 注册/登录弹窗可能从详情浮窗里打开，必须浮在浮窗遮罩之上 */
#registerModal, #loginModal { z-index: 99995; }
.modal-card {
  width: 100%; max-width: 400px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border-radius: 14px; padding: 22px;
  box-shadow: var(--shadow-lg); animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98);} to { opacity: 1; transform: none;} }
.modal-card h3 { font-size: 17px; margin-bottom: 4px; }
.modal-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.modal-label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
.modal-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #f8fafc; font-size: 14px; outline: none; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.modal-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); background: #fff; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ========== 详情页管理入口 / 管理面板 ========== */
.manage-entry { display: flex; align-items: center; gap: 10px; margin: -6px 0 16px; flex-wrap: wrap; }
.btn-manage-login {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.btn-manage-login:hover { border-color: var(--primary); color: var(--primary); }
.manage-entry-hint { font-size: 12px; color: var(--muted); }

.manage-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.manage-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.manage-head h3 { font-size: 15px; flex: 1; }
.manage-head-ops { display: flex; align-items: center; gap: 8px; }
.manage-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.manage-tab {
  padding: 9px 14px; border: none; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit;
  white-space: nowrap; transition: all .15s;
}
.manage-tab:hover { color: var(--text); }
.manage-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.manage-pane label { font-size: 13px; }
.manage-pane textarea, .manage-pane input[type=text], .manage-pane input[type=datetime-local] {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #f8fafc; font-size: 13.5px; outline: none; font-family: inherit;
  transition: border-color .2s, box-shadow .2s; margin-bottom: 10px;
}
.manage-pane textarea:focus, .manage-pane input[type=text]:focus, .manage-pane input[type=datetime-local]:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); background: #fff;
}
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-2col .modal-label { margin-top: 2px; }

.manage-pane .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.m-item {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; margin-bottom: 10px; background: #fafbfc;
}
.m-item .m-row { display: flex; gap: 8px; margin-bottom: 8px; }
.m-item .m-row > * { flex: 1; min-width: 0; }
.m-item .m-ops { display: flex; gap: 8px; justify-content: flex-end; }
.fb-row { font-size: 13px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.fb-row:last-child { border-bottom: 0; }
.fb-row .fb-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 拖拽上传高亮 */
.upload-box {
  border: 2px dashed var(--border); border-radius: 10px; padding: 22px 18px;
  text-align: center; color: var(--muted); font-size: 13px;
  transition: border-color .2s, background .2s; cursor: pointer;
}
.upload-box:hover { border-color: var(--primary); background: var(--primary-soft); }
.upload-box-btn {
  display: inline-block; padding: 8px 24px; border-radius: 8px;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 13.5px;
  box-shadow: 0 2px 6px rgba(59,130,246,.3); pointer-events: none;
}
.upload-box:hover .upload-box-btn { filter: brightness(1.06); }
.upload-box-hint { margin-top: 10px; font-size: 12px; color: var(--muted); }
.upload-box.dragover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.file-current { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; margin-bottom: 10px; }

/* 富文本编辑器（功能介绍） */
.rich-toolbar { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.rich-toolbar button {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all .12s; font-family: inherit;
}
.rich-toolbar button:hover { border-color: var(--primary); color: var(--primary); }
.rich-toolbar input[type=color].fore-color {
  width: 34px; height: 28px; padding: 2px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); cursor: pointer; transition: border-color .12s;
}
.rich-toolbar input[type=color].fore-color:hover { border-color: var(--primary); }
.rich-editor {
  min-height: 140px; max-height: 420px; overflow-y: auto;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #f8fafc; font-size: 13.5px; line-height: 1.7; outline: none;
  transition: border-color .2s, box-shadow .2s; margin-bottom: 10px;
}
.rich-editor:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); background: #fff; }
.rich-editor.dragover { border-color: var(--primary); background: var(--primary-soft); }
.rich-editor img { max-width: 100%; border-radius: 6px; margin: 6px 0; }
.rich-editor p { margin: 0 0 8px; }
/* FAQ 答案编辑器与「基本设置」的功能介绍编辑器同款样式（复用 .rich-toolbar/.rich-editor 全局样式） */
/* 工具栏+编辑器包一层，避免被 .m-item .m-row > *{flex:1} 拆成并排两列 */
.m-faq-edwrap { width: 100%; }
/* 版本记录：标题占大头，时间选择器固定宽度，日历图标放大 */
.m-item .m-cl-title { flex: 3; }
.m-item .m-cl-date { flex: 1.6; min-width: 200px; }
.m-item .m-cl-date::-webkit-calendar-picker-indicator {
  width: 22px; height: 22px; cursor: pointer; opacity: .75;
}
.m-item .m-cl-date::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* 功能介绍展示区（富文本） */
.desc-text img { max-width: 100%; border-radius: 8px; margin: 8px 0; }
.desc-text p { margin: 0 0 10px; }
.desc-text a { color: var(--primary); }

/* ========== 看板模式（仿永硕网盘目录列表，不左右分栏） ========== */
body.mode-board { height: auto; overflow: auto; }
body.mode-board .main { flex-direction: column; overflow: visible; }
body.mode-board .sidebar, body.mode-board .menu-toggle { display: none; }
body.mode-board .content { overflow-y: visible; padding: 0; }
body.mode-board .ai-bar { position: fixed; top: 10px; right: 10px; width: 380px; max-width: calc(100vw - 20px); }
body.mode-board .empty-state { display: none !important; }

.board-top {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  color: #fff; padding: 26px 18px 20px;
}
.board-top h1 { font-size: 20px; text-align: center; text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.board-top .board-search {
  max-width: 560px; margin: 0 auto; display: flex; gap: 8px;
}
.board-top .board-search input {
  flex: 1; padding: 10px 14px; border: none; border-radius: 8px;
  font-size: 14px; outline: none;
}
.board-top .board-search button {
  padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer;
  background: #0f2a5c; color: #fff; font-size: 14px; font-weight: 600;
}

.board-body { max-width: 960px; margin: 0 auto; padding: 16px 14px 60px; }
.board-nav { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.board-nav a { color: var(--primary); cursor: pointer; }

.board-game { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.board-game-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; cursor: pointer; user-select: none;
  background: linear-gradient(180deg, #f8fafc, #eef2f9);
  transition: background .15s;
}
.board-game-head:hover { background: linear-gradient(180deg, #eff6ff, #e0ecfd); }
.board-game-head .bg-icon { font-size: 20px; }
.board-game-head .bg-name { font-weight: 700; font-size: 15px; color: var(--text); }
.board-game-head .bg-count {
  margin-left: auto; font-size: 12px; color: var(--muted);
  background: #fff; border: 1px solid var(--border);
  padding: 2px 10px; border-radius: 10px; font-variant-numeric: tabular-nums;
}
/* 展开时：胶囊吸到右边，数量徽章紧跟其后（仅当有官网时，没官网徽章保持吸右） */
.board-game.open:has(.gs-website) .bg-count { margin-left: 0; }
.board-game.open .gs-website { margin-left: auto; }
.board-game-head .bg-arrow { font-size: 11px; color: var(--primary); transition: transform .2s; }
.board-game.open .bg-arrow { transform: rotate(90deg); }
.board-game-body { display: none; }
.board-game.open .board-game-body { display: block; }

.board-script {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.board-script:hover { background: #f8fafc; }
.board-script .bs-icon { font-size: 18px; flex-shrink: 0; }
.board-script .bs-main { flex: 1; min-width: 0; }
.board-script .bs-name { font-size: 14px; font-weight: 600; color: var(--text); }
.board-script .bs-desc {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.board-script .bs-size { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.board-script .bs-dl {
  flex-shrink: 0; padding: 6px 14px; border-radius: 8px;
  background: var(--green-bright); color: #fff; font-size: 12.5px; font-weight: 600;
  text-decoration: none; transition: background .15s;
}
.board-script .bs-dl:hover { background: var(--green-strong); text-decoration: none; }

.board-empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* 看板模式下详情页容器全宽居中 */
body.mode-board .detail-section.visible { max-width: 860px; margin: 0 auto; padding: 18px 14px 60px; }

/* ========== 看板模式：脚本详情浮窗 ========== */
.board-modal-card {
  position: relative; margin: auto; width: min(920px, 94vw);
  max-height: 90vh;
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 14px; padding: 0;
  box-shadow: var(--shadow-lg); animation: modalIn .18s ease;
}
.board-modal-header {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.board-modal-body {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 22px 12px;
}
/* 下载区钉在标题栏下方，滚动时常驻；与正文内容同宽 */
.board-modal-body .download-area.primary-action {
  position: sticky; top: 0; z-index: 4;
  margin: 0 0 15px; padding: 16px 0 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 12px -8px rgba(15, 23, 42, .12);
}
/* 详情首个卡片与常驻下载区的间距（下载区自带 margin-bottom，这里不重复） */
.board-modal-body .desc-card { margin-top: 0; }
/* 反馈是最后一个卡片，收掉尾部留白 */
.board-modal-body .feedback-card { margin-bottom: 0; }
/* 我的反馈（按签名 cookie 认人，只有本人提交过的才出现） */
.fb-mine-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 8px; }
.fb-mine-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: #fafcff; }
.fb-mine-body { font-size: 13px; color: #334155; white-space: pre-wrap; word-break: break-all; }
.fb-mine-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.fb-mine-reply { display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: #1e293b; background: #f0f9ff; border-left: 3px solid var(--primary); border-radius: 0 6px 6px 0; padding: 6px 10px; margin-top: 8px; }
.fb-mine-reply-badge { flex: none; font-size: 11px; color: #fff; background: var(--primary); border-radius: 4px; padding: 1px 6px; }
.fb-mine-reply-time { flex: none; margin-left: auto; font-size: 11px; color: var(--muted); }
/* 认领人管理面板的反馈回复 */
.fb-reply-line { display: flex; align-items: baseline; gap: 6px; font-size: 13px; background: #f8fafc; border-radius: 6px; padding: 6px 10px; margin-top: 8px; }
.fb-reply-input { display: flex; gap: 8px; margin-top: 8px; }
.fb-reply-input input { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.fb-reply-input input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
/* 细滚动条 */
.board-modal-body::-webkit-scrollbar { width: 8px; }
.board-modal-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.board-modal-body::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.board-modal-body::-webkit-scrollbar-track { background: transparent; }
.board-modal-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 12px;
}
.board-modal-ops { flex: none; display: flex; align-items: center; gap: 10px; }
.board-modal-close {
  width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  background: var(--surface); color: var(--muted); font-size: 15px; line-height: 1;
  transition: background .15s, color .15s;
}
.board-modal-close:hover { background: #fee2e2; border-color: #fecaca; color: #dc2626; }
.board-modal-body .detail-section.visible { max-width: none; margin: 0; padding: 0; }
/* 压过 body.mode-board .detail-section.visible 的 60px 底部留白，短内容浮窗不再拖长 */
body.mode-board .board-modal-body .detail-section.visible { padding: 0; }

/* 超窄屏（<380px）再收紧 */
@media (max-width: 380px) {
  .content { padding: 14px 10px; }
  .desc-card, .faq-card, .changelog-card, .feedback-card { padding: 16px 14px; }
  .form-2col { grid-template-columns: 1fr; }
  .board-script .bs-desc { display: none; }
}

/* ===== 顶部滚动公告栏（科技感跑马灯） ===== */
.announce-bar {
  position: relative; display: flex; align-items: stretch; overflow: hidden;
  background: linear-gradient(90deg, #060b1f 0%, #0a1233 45%, #060b1f 100%);
  border-bottom: 1px solid rgba(56, 189, 248, .35);
  box-shadow: 0 2px 12px rgba(2, 132, 199, .25), inset 0 -1px 0 rgba(56,189,248,.15);
  z-index: 30;
}
/* 顶部霓虹渐变 */
.announce-bar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(56,189,248,.10), transparent 40%, rgba(56,189,248,.06));
}
/* 高光滑块循环扫过 */
.announce-bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 120px; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(125,211,252,.14), transparent);
  animation: ann-shine 4.5s linear infinite;
}
@keyframes ann-shine {
  0% { left: -140px; }
  100% { left: calc(100% + 20px); }
}
.announce-badge {
  flex: none; display: flex; align-items: center; gap: 6px;
  padding: 6px 20px 6px 12px; margin: 5px 0 5px 8px; align-self: center;
  font-size: 12px; font-weight: 700; letter-spacing: 2px; color: #e0f2fe;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  border: 1px solid rgba(125,211,252,.5); border-radius: 4px;
  text-shadow: 0 0 8px rgba(125,211,252,.8);
  box-shadow: 0 0 12px rgba(14,165,233,.45), inset 0 0 8px rgba(255,255,255,.12);
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.announce-badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #fbbf24;
  box-shadow: 0 0 8px #fbbf24, 0 0 3px #fff;
  animation: ann-blink 1.1s ease-in-out infinite;
}
@keyframes ann-blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.announce-viewport {
  flex: 1; overflow: hidden; display: flex; align-items: center;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.announce-track {
  display: flex; width: max-content;
  animation: ann-scroll 20s linear infinite;
}
.announce-bar:hover .announce-track { animation-play-state: paused; }
@keyframes ann-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.announce-text {
  flex: none; min-width: 100vw; white-space: nowrap;
  padding: 9px 60px 9px 14px; box-sizing: border-box;
  font-size: clamp(12px, 3.6vw, 15px); font-weight: 600; line-height: 1.5;
  color: #7dd3fc; text-shadow: 0 0 10px rgba(56,189,248,.55);
}
/* 手机端：徽标缩小、文字更紧凑 */
@media (max-width: 640px) {
  .announce-badge { margin-left: 6px; padding: 5px 16px 5px 9px; font-size: 11px; letter-spacing: 1px; }
  .announce-text { padding-right: 40px; }
}

/* ===== 待审核脚本提示横幅 ===== */
.pending-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; margin-bottom: 16px;
  background: linear-gradient(90deg, #fef3c7, #fef9c3);
  border: 1px solid #f59e0b; border-left: 4px solid #f59e0b;
  border-radius: 10px; color: #92400e; font-size: 14px; font-weight: 500;
  box-shadow: 0 2px 8px rgba(245, 158, 11, .18);
}
.pending-banner::before {
  content: "⏳"; font-size: 18px; margin-right: 4px;
  animation: ann-blink 1.6s ease-in-out infinite;
}
/* 下载按钮禁用态 */
.btn-download.disabled {
  pointer-events: none; opacity: .55; filter: grayscale(.4);
}

/* 注册弹窗提示条 */
.reg-tip {
  display: flex; gap: 10px; align-items: center;
  margin: 2px 0 4px; padding: 9px 12px;
  background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  border: 1px solid #bfdbfe; border-radius: 10px;
  font-size: 12.5px; line-height: 1.5; color: #1e40af;
  white-space: nowrap; overflow: hidden;
}
.reg-tip-icon { flex: none; font-size: 15px; }
.reg-tip-text { overflow: hidden; text-overflow: ellipsis; }
.reg-tip-text b { color: #1d4ed8; }

/* 侧栏筛选无结果提示 */
.sidebar-no-match {
  padding: 18px 14px; text-align: center; color: var(--muted); font-size: 13px;
}

/* ===== 游戏备注（看板模式游戏名后绿色小字） ===== */
.game-remark {
  flex: none; max-width: 40%;
  font-size: 12px; font-weight: 400; color: #16a34a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .game-remark { max-width: 55%; }
}
