/* ============================================================
   HiGif 作品站 · 简约白主题
   白底 / 分隔线 #E5E7EB / 正文 #374151 / 次要 #9CA3AF
   红点缀 #E5484D / 边框 #D1D5DB
   ============================================================ */
:root {
  --text: #374151;
  --muted: #9ca3af;
  --line: #e5e7eb;
  --border: #d1d5db;
  --accent: #e5484d;
  --accent-dark: #d13a40;
  --ok: #16a34a;
  --bg: #ffffff;
  --bg-soft: #fafafa;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; transition: color .12s; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- 顶栏 ---------- */
.top {
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px);
}
.top-in {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  height: 58px; display: flex; align-items: center; justify-content: space-between;
}
.logo { font-weight: 700; font-size: 17px; }
.logo em { font-style: normal; color: var(--accent); }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.top nav a:hover, .top nav a.on { color: var(--accent); }
.top nav a.on { font-weight: 600; }

/* 顶栏搜索框：胶囊输入框 + 内置放大镜按钮 */
.search { position: relative; flex: 1; max-width: 300px; margin: 0 22px; }
.search input {
  width: 100%; height: 34px; border: 1px solid var(--border); border-radius: 999px;
  padding: 0 38px 0 15px; font-size: 13px; color: var(--text);
  background: var(--bg-soft); outline: none; transition: border-color .12s ease, background .12s ease;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--accent); background: #fff; }
.search button {
  position: absolute; right: 4px; top: 4px; width: 26px; height: 26px;
  border-radius: 50%; border: 0; background: none; cursor: pointer;
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  transition: color .12s ease, background .12s ease;
}
.search button:hover { color: var(--accent); background: rgba(229,72,77,.08); }
@media (max-width: 860px) { .search { max-width: 200px; margin: 0 12px; } }
@media (max-width: 640px) { .search { display: none; } }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px 34px; min-height: calc(100vh - 150px); }
.foot { border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }
.foot a:hover { color: var(--accent); }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 66px 0 44px; }
.hero-badge {
  display: inline-block; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 3px 14px; font-size: 13px; margin-bottom: 18px;
}
.hero h1 { font-size: 38px; margin: 0 0 14px; line-height: 1.25; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lead { color: var(--muted); max-width: 640px; margin: 0 auto 28px; font-size: 16px; }
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-meta { margin-top: 16px; font-size: 13px; color: var(--muted); }

.section { margin: 46px 0; }
.section h2 { font-size: 21px; margin: 0 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.feats { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.feat { border: 1px solid var(--line); border-radius: 10px; padding: 15px 17px; }
.feat b { display: block; font-size: 15px; margin-bottom: 3px; }
.feat span { font-size: 13px; color: var(--muted); }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: st;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.steps li { border: 1px solid var(--line); border-radius: 10px; padding: 15px 17px; font-size: 14px; }
.steps li::before {
  counter-increment: st; content: counter(st);
  display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; margin-right: 8px;
}
pre.cmd {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; font-size: 13px; overflow-x: auto; margin: 0;
}
.ver-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.ver-item:last-child { border-bottom: 0; }
.ver-h { display: flex; gap: 12px; align-items: baseline; }
.ver-tag { color: var(--accent); font-weight: 700; }
.ver-date { color: var(--muted); font-size: 13px; }
.ver-notes { font-size: 14px; margin-top: 4px; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-block; background: var(--accent); color: #fff;
  border: 1px solid var(--accent); padding: 9px 22px; border-radius: 8px;
  font-size: 14px; line-height: 1.4; cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-o { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-o:hover { background: #fff; color: var(--accent); border-color: var(--accent); }
.btn-sm { padding: 4px 12px; font-size: 13px; border-radius: 6px; }
.btn-full { width: 100%; margin-top: 18px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.in {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text); outline: none; background: #fff;
}
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(229,72,77,.08); }
.fl { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.form-err { color: var(--accent); font-size: 13px; margin: 10px 0 0; }
.img-tip { font-size: 13px; margin-top: 6px; min-height: 20px; }
.img-tip.bad { color: var(--accent); }
.img-tip.good { color: var(--ok); }
#img_prev { display: none; margin-top: 10px; max-height: 180px; border: 1px solid var(--line); border-radius: 8px; }

.notice { border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin: 18px 0; font-size: 14px; }
.notice-ok { border-color: var(--ok); background: rgba(22,163,74,.04); color: var(--ok); }
.notice-ok b, .notice-ok a { color: var(--ok); }
.notice-warn { border-color: var(--accent); background: rgba(229,72,77,.04); }
.notice-warn a { color: var(--accent); font-weight: 600; }

.page-head { margin: 30px 0 22px; }
.page-head h1 { margin: 0 0 4px; font-size: 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
.empty a { color: var(--accent); }
.load-end { text-align: center; color: var(--muted); padding: 26px 0 40px; font-size: 13px; }

/* ---------- 瀑布流（固定宽 360px，高度按图片比例） ---------- */
.masonry { column-width: 360px; column-gap: 24px; }
.wcard {
  break-inside: avoid; -webkit-column-break-inside: avoid;
  margin: 0 0 24px; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; cursor: zoom-in; background: #fff;
  transition: box-shadow .15s ease;
}
.wcard:hover { box-shadow: 0 4px 18px rgba(17,24,39,.08); }
.wcard img { display: block; width: 100%; height: auto; background: var(--bg-soft); }
/* 首帧快照 + 居中播放按钮 */
.wfreeze-wrap { position: relative; display: block; }
.wfreeze-wrap canvas { display: block; width: 100%; height: auto; background: var(--bg-soft); }
.wfreeze-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(17,24,39,.5); box-shadow: 0 2px 12px rgba(0,0,0,.25);
  pointer-events: none; transition: background .12s ease;
}
.wfreeze-play::after {
  content: ''; position: absolute; left: 20px; top: 15px;
  border-left: 15px solid #fff; border-top: 10px solid transparent; border-bottom: 10px solid transparent;
}
.wcard:hover .wfreeze-play { background: rgba(229,72,77,.85); }
.wmeta { padding: 10px 14px 12px; }
.wtitle { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsub { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wstats { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 灯箱统计徽章 + 表态按钮 */
.lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lb-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.lb-chip {
  font-size: 12px; color: var(--muted); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 11px; white-space: nowrap;
}
.lb-chip b { color: var(--text); font-weight: 600; margin-left: 2px; }
.lb-actions { display: flex; gap: 10px; }
.lb-actions .btn-like.voted { background: #e5484d; border-color: #e5484d; color: #fff; }
.lb-actions .btn-o.voted { background: #374151; border-color: #374151; color: #fff; }

/* 表态动效：emoji 从按钮上方冒出，逐步放大并上飘消散 */
.lb-float {
  position: fixed; z-index: 300; font-size: 40px; line-height: 1;
  pointer-events: none; user-select: none;
  filter: drop-shadow(0 2px 10px rgba(17,24,39,.25));
  animation: lbFloat .9s ease-out forwards;
}
@keyframes lbFloat {
  0%   { transform: translate(-50%, 0) scale(.3) rotate(0deg); opacity: 0; }
  18%  { opacity: 1; }
  60%  { transform: translate(-50%, -70px) scale(1.35) rotate(-8deg); opacity: 1; }
  100% { transform: translate(-50%, -130px) scale(1.7) rotate(6deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .lb-float { animation: none; opacity: 0; }
}
/* 轻提示条：自动消失，无需点击确认 */
.lb-toast {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(17,24,39,.85); color: #fff; font-size: 13px;
  padding: 8px 18px; border-radius: 999px; z-index: 3; white-space: nowrap;
  opacity: 1; transition: opacity .35s ease;
  animation: lbToastIn .18s ease-out;
  pointer-events: none;
}
@keyframes lbToastIn {
  from { transform: translate(-50%, -8px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
/* 重复表态：按钮摇头抖动 */
@keyframes lbShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-3px); }
}
.btn.shake { animation: lbShake .32s ease; }

/* 徽标 */
.badge {
  display: inline-block; font-size: 12px; padding: 0 9px; line-height: 20px;
  border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.badge-wait { color: var(--accent); border-color: var(--accent); background: rgba(229,72,77,.05); }
.badge-ok { color: var(--ok); border-color: var(--ok); background: rgba(22,163,74,.06); }
.badge-off { color: var(--muted); }
.badge-pause { color: #b45309; border-color: #b45309; background: rgba(180,83,9,.06); }

/* ---------- 灯箱 ---------- */
.lightbox { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lb-backdrop { position: absolute; inset: 0; background: rgba(17,24,39,.78); }
.lb-body {
  position: relative; background: #fff; border-radius: 12px; overflow: hidden;
  max-width: 720px; width: 100%; max-height: 92vh;
  display: flex; flex-direction: column;
  animation: lbIn .16s ease-out;
}
@keyframes lbIn {
  from { transform: scale(.96); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
/* 图片舞台：深色底衬托，长图在剩余空间内滚动 */
.lb-stage {
  background: #111827; padding: 18px; flex: 1 1 auto;
  min-height: 0; overflow: auto;
  display: flex; align-items: center; justify-content: center;
}
.lb-stage img { max-width: 100%; max-height: 66vh; height: auto; border-radius: 6px; display: block; }
/* 信息区：标题 / 作者时间 / 统计徽章 + 表态按钮 */
.lb-info { padding: 14px 18px 16px; border-top: 1px solid var(--line); flex-shrink: 0; }
.lb-head h3 { margin: 0; font-size: 16px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.lb-bar { margin-top: 12px; }
.lb-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(17,24,39,.55); color: #fff; font-size: 18px; line-height: 1;
  cursor: pointer; transition: background .12s ease;
}
.lb-close:hover { background: var(--accent); }
@media (max-width: 560px) {
  .lightbox { padding: 10px; }
  .lb-stage { padding: 10px; }
  .lb-stage img { max-height: 56vh; }
  .lb-info { padding: 12px 14px 14px; }
}

/* ---------- 登录 / 注册 ---------- */
.auth-card {
  max-width: 780px; margin: 44px auto; border: 1px solid var(--line);
  border-radius: 14px; padding: 36px 40px; display: flex; gap: 36px;
}
.auth-col { flex: 1; min-width: 0; }
.auth-col h2 { margin: 0 0 4px; font-size: 20px; }
.auth-sep { width: 1px; background: var(--line); flex-shrink: 0; }

/* ---------- 发布页 ---------- */
.pub-card {
  max-width: 640px; margin: 26px auto 0; border: 1px solid var(--line);
  border-radius: 14px; padding: 30px 34px; background: #fff;
}
.pub-card h2 { margin: 0; font-size: 19px; }
/* 拖拽上传区 */
.dz {
  border: 2px dashed var(--border); border-radius: 12px; padding: 32px 16px 28px;
  text-align: center; cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.dz:hover, .dz.over { border-color: var(--accent); background: rgba(229,72,77,.03); }
.dz-ico { display: block; margin: 0 auto 8px; color: var(--muted); transition: color .15s ease; }
.dz:hover .dz-ico, .dz.over .dz-ico { color: var(--accent); }
.dz-main { font-size: 14px; font-weight: 600; }
.dz-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
/* 已选文件：缩略图预览条 */
.dz-prev {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg-soft);
}
.dz-prev img {
  width: 74px; height: 56px; object-fit: contain; flex-shrink: 0;
  border-radius: 6px; background: #fff; border: 1px solid var(--line);
}
.dz-finfo { flex: 1; min-width: 0; }
.dz-finfo b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-finfo span { font-size: 12px; color: var(--muted); }
.dz-del {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  font-size: 12px; padding: 5px 12px; cursor: pointer; color: var(--muted);
  transition: color .12s ease, border-color .12s ease;
}
.dz-del:hover { color: var(--accent); border-color: var(--accent); }
.dz-tip { color: var(--accent); font-size: 12px; min-height: 18px; margin: 6px 2px 0; }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
/* 发布须知 */
.pub-tips {
  list-style: none; margin: 20px 0 0; padding: 12px 16px;
  background: var(--bg-soft); border-radius: 10px; font-size: 13px; color: var(--muted);
}
.pub-tips li { margin: 3px 0; }
.pub-tips li::before { content: '·'; color: var(--accent); font-weight: 700; margin-right: 8px; }
@media (max-width: 560px) { .pub-card { padding: 22px 18px; } }

/* ---------- 后台 ---------- */
.admin { display: flex; min-height: 100vh; }
/* 后台分页 */
.pager { margin: 18px 0 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pg-btn {
  min-width: 30px; height: 30px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff;
  transition: color .12s ease, border-color .12s ease;
}
.pg-btn:hover { border-color: var(--accent); color: var(--accent); }
.pg-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pg-dots { color: var(--muted); padding: 0 2px; }
.aside { width: 200px; flex-shrink: 0; border-right: 1px solid var(--line); padding: 20px 0; }
.aside-logo { font-weight: 700; font-size: 16px; padding: 0 22px 14px; }
.aside-logo em { font-style: normal; color: var(--accent); }
.aside a { display: block; padding: 10px 22px; font-size: 14px; }
.aside a:hover { background: var(--bg-soft); }
.aside a.on { color: var(--accent); font-weight: 600; background: var(--bg-soft); border-right: 2px solid var(--accent); }
.aside-sep { height: 1px; background: var(--line); margin: 12px 0; }
.amain { flex: 1; padding: 26px 34px 40px; min-width: 0; }
.page-title { margin: 0 0 20px; font-size: 22px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
.tbl .ops { display: flex; gap: 8px; }
.tbl form { display: inline; }

/* 仪表盘三大块 */
.dash { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.dcard { border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.dcard h3 { margin: 0 0 12px; font-size: 15px; color: var(--muted); font-weight: 600; }
.dmain { display: flex; align-items: baseline; gap: 10px; }
.dnum { font-size: 34px; font-weight: 700; line-height: 1.1; }
.dl { font-size: 13px; color: var(--muted); }
.dsub {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px;
  margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px;
}
.m { min-width: 0; }
.m .mv { font-weight: 600; font-size: 17px; }
.m .mv .up, .m .mv .down, .m .mv .flat { font-size: 12px; font-weight: 500; margin-left: 3px; }
.m .ml { font-size: 12px; color: var(--muted); margin-top: 1px; }
.m-alert .mv a { color: var(--accent); }
.up { color: var(--ok); }
.down { color: var(--accent); }
.flat { color: var(--muted); }

/* 审核条目 */
.rev-item {
  display: flex; gap: 16px; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin-bottom: 16px; align-items: flex-start; flex-wrap: wrap;
}
.rev-item img { width: 160px; height: auto; border-radius: 8px; border: 1px solid var(--line); flex-shrink: 0; background: var(--bg-soft); }
.rev-info { flex: 1; min-width: 240px; font-size: 14px; }
.rev-info .kv { margin: 2px 0; }
.rev-info .kv b { font-weight: 600; }
.rev-info .kv .dim { color: var(--muted); font-size: 12px; word-break: break-all; }
.rev-actions { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }

/* 后台登录 */
.admin-login { max-width: 380px; margin: 90px auto 0; border: 1px solid var(--line); border-radius: 14px; padding: 34px 36px; }
.admin-login h1 { margin: 0 0 6px; font-size: 22px; text-align: center; }
.admin-login .tip { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 8px; }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .hero h1 { font-size: 30px; }
  .dash { grid-template-columns: 1fr; }
  .auth-card { flex-direction: column; gap: 28px; }
  .auth-sep { width: auto; height: 1px; }
  .admin { flex-direction: column; }
  .aside { width: auto; border-right: 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; padding: 8px; }
  .aside-logo, .aside-sep { display: none; }
  .aside a { padding: 8px 12px; border-radius: 8px; }
  .aside a.on { border-right: 0; }
  .amain { padding: 20px 16px 32px; }
}

/* ---------- 上传进度条 ---------- */
.up-progress { margin: 2px 0 14px; }
.up-bar { height: 8px; background: var(--bg-soft, #f3f4f6); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.up-fill { height: 100%; width: 0; background: #e5484d; border-radius: 999px; transition: width .2s ease; }
.up-bar.busy .up-fill {
  /* 校验等待期：条纹滚动动画，表明服务器在处理 */
  background-image: linear-gradient(45deg, rgba(255,255,255,.4) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.4) 50%, rgba(255,255,255,.4) 75%, transparent 75%, transparent);
  background-size: 14px 14px;
  animation: upmove .6s linear infinite;
}
@keyframes upmove { from { background-position: 0 0; } to { background-position: 28px 0; } }
.up-text { margin-top: 6px; color: var(--muted); font-size: 13px; }
