/* ===== 设计令牌 & 基础重置 ===== */

:root {
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --shadow-lg: 0 24px 60px -20px rgba(8, 12, 24, .55);
  --shadow: 0 10px 30px -12px rgba(8, 12, 24, .45);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", -apple-system,
          BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}

/* 主题色板 */
[data-accent="violet"] { --brand: #7c5cff; --brand-2: #c56bff; }
[data-accent="cyan"]   { --brand: #0ea5e9; --brand-2: #22d3ee; }
[data-accent="flame"]  { --brand: #f97316; --brand-2: #f43f5e; }
[data-accent="jade"]   { --brand: #10b981; --brand-2: #14b8a6; }

/* 深色（默认） */
[data-theme="dark"] {
  --bg: #0a0c12;
  --bg-grad-1: #1a1240;
  --bg-grad-2: #06283d;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .07);
  --surface-solid: #131724;
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #e9edf6;
  --text-dim: #98a2b8;
  --text-mute: #6b7488;
  --grid-line: rgba(255, 255, 255, .14);
  color-scheme: dark;
}

/* 浅色 */
[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-grad-1: #e5e0ff;
  --bg-grad-2: #d9f0f7;
  --surface: rgba(255, 255, 255, .78);
  --surface-2: #ffffff;
  --surface-solid: #ffffff;
  --border: rgba(16, 24, 45, .09);
  --border-strong: rgba(16, 24, 45, .16);
  --text: #131a2b;
  --text-dim: #5b657c;
  --text-mute: #8a93a8;
  --grid-line: rgba(16, 24, 45, .18);
  --shadow-lg: 0 24px 50px -24px rgba(24, 34, 62, .28);
  --shadow: 0 10px 26px -14px rgba(24, 34, 62, .22);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .35s var(--ease), color .35s var(--ease);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--brand); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 20px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--brand); background-clip: padding-box; }

/* 通用按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
              background .18s var(--ease), border-color .18s var(--ease), opacity .18s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:disabled { opacity: .45; pointer-events: none; }

.btn-primary {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 26px -10px color-mix(in srgb, var(--brand) 70%, transparent);
}
.btn-primary:hover {
  box-shadow: 0 16px 34px -10px color-mix(in srgb, var(--brand) 85%, transparent);
}

.btn-ghost { background: transparent; }
.btn-danger { color: #ff6b81; border-color: color-mix(in srgb, #ff6b81 40%, transparent); }
.btn-danger:hover { background: rgba(255, 107, 129, .12); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 10px; }

/* 玻璃卡片 */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* 渐入动画 */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .5s var(--ease) both; }

/* Toast */
.toast-wrap {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  animation: toastIn .28s var(--ease);
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.ok { border-left: 3px solid #22c55e; }
.toast.err { border-left: 3px solid #ff6b81; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== 前后台共用组件 ===== */

/* 背景光效（前台后台都用；已改为纯透明，背景由 .bg-grid 网格线呈现） */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

/* Logo 徽标（前台导航 / 后台侧栏共用） */
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 21px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--brand) 80%, transparent);
}

/* 弹窗遮罩（前台详情 / 后台表单共用）
   注意：必须是 fixed + grid 居中，否则弹窗会被塞到页面底部，看起来像"点了没反应" */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5, 7, 13, .68);
  display: grid; place-items: center;
  padding: 24px;
  animation: maskIn .22s var(--ease);
  overflow: auto;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(22px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 地址 / 代码块展示 */
.url-box {
  margin-top: 14px; padding: 13px 15px; border-radius: 12px;
  background: var(--surface); border: 1px dashed var(--border-strong);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px; color: var(--text-dim); word-break: break-all;
}

/* 空状态 */
.empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--text-mute);
}
.empty-icon { font-size: 46px; opacity: .5; margin-bottom: 12px; }

/* ===== 游戏截图（后台上传预览 / 前台详情画廊共用） ===== */
/* 隐藏的 file input：用视觉隐藏而非 display:none，
   部分内嵌 WebView 会忽略对 display:none 元素的点击转发 */
.hidden-file {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; border: 0; padding: 0; margin: 0;
}
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.shot-empty {
  grid-column: 1 / -1; padding: 22px; text-align: center;
  font-size: 13px; color: var(--text-mute);
  border: 1px dashed var(--border-strong); border-radius: 12px;
}
.shot-thumb {
  position: relative; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.shot-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 截图灯箱（点缩略图放大） */
.lightbox { z-index: 500; background: rgba(0, 0, 0, .88); cursor: zoom-out; }
/* 图片舞台：箭头相对它定位，从而叠在图片左右边缘上 */
.lb-stage { position: relative; display: inline-block; line-height: 0; max-width: 92vw; max-height: 92vh; }
.lb-stage img {
  width: auto; max-width: 100%; max-height: 92vh; display: block;
  border-radius: 14px; box-shadow: var(--shadow-lg);
}

/* 灯箱左右切换控件（浮在图片上，强对比保证可见） */
.lb-close {
  position: fixed; top: 22px; right: 24px; z-index: 3;
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 18px;
  cursor: pointer; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .6); box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
  transition: background .2s;
}
.lb-close:hover { background: rgba(0, 0, 0, .78); }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 54px; height: 54px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 32px; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .6); box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
  transition: background .2s, transform .12s;
}
.lb-nav:hover { background: rgba(0, 0, 0, .78); }
.lb-nav:active { transform: translateY(-50%) scale(.92); }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }
.lb-count {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  padding: 6px 14px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px;
  font-variant-numeric: tabular-nums; border: 1px solid rgba(255, 255, 255, .45);
}
