/* PhotoVault 样式 */
:root {
  --bg: #0d1220;
  --bg2: #131a2e;
  --card: #18213a;
  --line: #2a3554;
  --text: #e8ecf7;
  --muted: #8b96b5;
  --accent: #5b8cff;
  --accent2: #7c5bff;
  --ok: #3ecf8e;
  --warn: #ffb454;
  --danger: #ff5c7a;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2547 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 60px;
}
.wrap { width: 100%; max-width: 760px; }
header.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.logo {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center; font-size: 24px;
  box-shadow: 0 6px 24px rgba(91, 140, 255, .35);
}
h1 { font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.card h2 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

/* 上传区 */
.drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
  background: rgba(255,255,255,.02);
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); background: rgba(91,140,255,.06); }
.drop .big { font-size: 38px; margin-bottom: 10px; }
.drop b { color: var(--text); }
.tip { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* 预览格 */
.previews { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.prev {
  position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #0a0f1d;
}
.prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prev .rm {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 6px;
  background: rgba(0,0,0,.65); color: #fff; border: none; cursor: pointer; font-size: 12px; line-height: 20px;
}
.prev .nm {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; padding: 2px 5px;
  background: rgba(0,0,0,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 控件行 */
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
select {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; font-size: 13px;
}
.btn {
  border: none; border-radius: 10px; padding: 11px 22px; font-size: 14px; font-weight: 600;
  cursor: pointer; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 16px rgba(91,140,255,.3);
}
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; border: 1px solid var(--line); box-shadow: none; color: var(--muted); }
.btn.danger { background: linear-gradient(135deg, #ff5c7a, #ff8a5c); box-shadow: 0 4px 16px rgba(255,92,122,.25); }
.btn.small { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

/* 链接卡片 */
.linkcard {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 12px;
  background: var(--bg2); display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.linkcard .info { flex: 1; min-width: 200px; }
.linkurl {
  font-family: Consolas, monospace; font-size: 12px; color: #9db7ff;
  word-break: break-all; user-select: all; cursor: pointer;
}
.linkmeta { font-size: 11px; color: var(--muted); margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.badge { font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.badge.pending { background: rgba(62,207,142,.15); color: var(--ok); }
.badge.used { background: rgba(255,180,84,.15); color: var(--warn); }
.badge.burned, .badge.expired, .badge.missing { background: rgba(255,92,122,.15); color: var(--danger); }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 14px 0; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: #20294a; color: var(--text); border: 1px solid var(--line);
  padding: 10px 20px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 99;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 查看器页面 ===== */
body.viewer { padding: 0; }
.vtop {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: rgba(13,18,32,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.vtop .t { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.countdown { font-family: Consolas, monospace; font-size: 15px; color: var(--warn); font-weight: 700; }
.countdown.low { color: var(--danger); }

.stage {
  position: relative; margin: 90px auto 30px; max-width: min(92vw, 1000px);
  display: flex; align-items: center; justify-content: center;
}
.stage img.photo {
  max-width: 100%; max-height: 72vh; border-radius: 12px;
  user-select: none; -webkit-user-drag: none; display: block;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
}
/* 透明防护层：挡住右键/拖拽，叠加动态水印 */
.shield {
  position: absolute; inset: -6px; z-index: 5; border-radius: 12px;
  background-repeat: repeat; cursor: default;
  -webkit-touch-callout: none; -webkit-user-select: none;
}
.stage img.photo, .cell img { -webkit-touch-callout: none; }
.navbtn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 6;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(19,26,46,.85); color: var(--text); font-size: 18px; cursor: pointer;
}
.navbtn.prev { left: -56px; } .navbtn.next { right: -56px; }
.navbtn:disabled { opacity: .25; cursor: default; }
.counter { text-align: center; color: var(--muted); font-size: 13px; margin-top: 12px; }
.notice {
  max-width: 640px; margin: 18px auto 0; text-align: center; color: var(--muted);
  font-size: 12px; line-height: 1.8;
}

/* 全屏居中提示 */
.center-screen {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 20px;
}
.center-screen .icon { font-size: 56px; }
.center-screen h2 { font-size: 20px; }
.center-screen p { color: var(--muted); font-size: 14px; max-width: 420px; line-height: 1.7; }
.spin {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: r 1s linear infinite;
}
@keyframes r { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .navbtn.prev { left: 8px; } .navbtn.next { right: 8px; } }

/* ===== 管理后台扩展 ===== */
.text-input {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 14px; margin-bottom: 14px;
}
.text-input:focus { outline: none; border-color: var(--accent); }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1; padding: 11px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; font-weight: 600;
}
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent; }

.libbar { display: flex; align-items: center; gap: 14px; margin: 18px 0 10px; flex-wrap: wrap; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.chk input { accent-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.cell {
  position: relative; border-radius: 12px; overflow: hidden; cursor: pointer;
  border: 2px solid var(--line); aspect-ratio: 1; background: #0a0f1d;
  transition: border-color .15s, transform .15s;
}
.cell:hover { border-color: #40507e; }
.cell.picked { border-color: var(--accent); transform: scale(.97); }
.cell img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.cell .check {
  position: absolute; top: 7px; right: 7px; width: 22px; height: 22px; border-radius: 7px;
  background: rgba(0,0,0,.55); border: 1.5px solid rgba(255,255,255,.6);
  color: #fff; font-size: 13px; line-height: 20px; text-align: center; font-weight: 700;
}
.cell.picked .check { background: var(--accent); border-color: var(--accent); }
.cell .nm {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; padding: 3px 7px;
  background: linear-gradient(transparent, rgba(0,0,0,.85)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell .nm span { color: var(--muted); margin-left: 5px; }

.card-inner { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.badge.active { background: rgba(62,207,142,.15); color: var(--ok); }
