* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b0d10;
  --card: #15181d;
  --line: #262b33;
  --text: #e8ecef;
  --dim: #8b939e;
  --accent: #3ddc97;
  --danger: #e2604f;
}

html {
  height: 100%;
  background: var(--bg);
}

body {
  /* 关键：min-height 而非 height。内容超过一屏时 body 能被撑高，
     否则固定高度 + 垂直居中会把顶部内容溢出到视口之外且滚不回来 */
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

main { width: 100%; max-width: 420px; }

h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.slogan { font-size: 12px; color: var(--dim); letter-spacing: 1px; margin-bottom: 20px; }
h2 { font-size: 14px; font-weight: 500; color: var(--dim); margin: 24px 0 8px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

label { display: block; font-size: 12px; color: var(--dim); margin: 14px 0 6px; }

.pick {
  display: block;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 28px 0;
  text-align: center;
  color: var(--dim);
  font-size: 14px;
  cursor: pointer;
  margin: 0;
}
.pick:active { border-color: var(--accent); color: var(--accent); }

#thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#thumbs .thw { position: relative; width: 52px; height: 52px; }
#thumbs .thw img {
  width: 100%; height: 100%;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  display: block;
}
#thumbs .thw i {
  position: absolute; top: -7px; right: -7px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: #2a2f38;
  color: var(--text);
  font-size: 12px; font-style: normal; line-height: 17px;
  text-align: center;
  cursor: pointer;
}

.row { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 13px;
  cursor: pointer;
}
.chip.on { border-color: var(--accent); color: var(--accent); }

button.primary {
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #06281a;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:disabled { opacity: 0.35; cursor: default; }

button.ghost {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--dim);
  font-size: 14px;
  cursor: pointer;
}

button.danger {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: var(--danger);
  color: #2b0b07;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.linkrow { display: flex; gap: 8px; margin-bottom: 8px; }
.linkrow input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  -webkit-user-select: text; user-select: text;
}
.linkrow button {
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#qr { display: block; width: 160px; margin: 14px auto 4px; border-radius: 10px; }
#save-qr { width: 160px; display: block; margin: 0 auto; padding: 9px; }

/* 创建 → 完成的转场：只用合成器属性，避免卡顿 */
#step-done { animation: riseIn .3s cubic-bezier(.2,.7,.3,1) both; }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  #step-done { animation: none; }
}

.warn { color: var(--danger); font-size: 12px; margin-top: 6px; }

#progress { margin-top: 16px; }
#progress .track { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
#progress .track i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#progress span { display: block; margin-top: 8px; font-size: 12px; color: var(--dim); text-align: center; }

/* ---------- 顶栏与账号 ---------- */
header.top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  margin-bottom: 4px;
}
header.top a { font-size: 13px; color: var(--accent); text-decoration: none; }
#nav-user { color: var(--dim); font-size: 13px; }

/* 记录列表很长：顶栏吸顶，返回按钮始终可见 */
header.top.sticky {
  position: sticky;
  top: 0;
  z-index: 40;
  justify-content: space-between;
  background: var(--bg);
  padding: 12px 0 12px;
  margin-bottom: 8px;
}
header.top.sticky a { padding: 4px 0; }
header.top.sticky + h1 { margin-top: 12px; }
button.linkish {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
}
#auth-hint { margin-top: 12px; font-size: 12px; color: var(--dim); text-align: center; }
#auth-hint .linkish { font-size: 12px; }

#auth-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 60;
}
.auth-card {
  width: 100%; max-width: 320px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}
.auth-card h3 { font-size: 17px; margin-bottom: 16px; }
.auth-card input {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-user-select: text; user-select: text;
}
.auth-card .ghost { margin-top: 8px; padding: 10px; }

/* ---------- 开屏 ---------- */
#splash {
  position: fixed; inset: 0;
  z-index: 100;
  background: radial-gradient(120% 110% at 50% 32%, #11151c 0%, #06080b 72%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .6s ease;
}
#splash.out { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; animation: splashIn 1s cubic-bezier(.2,.7,.3,1) both; }
.splash-inner h1 {
  font-size: 46px;
  font-weight: 200;
  letter-spacing: 16px;
  text-indent: 16px;
  color: var(--text);
}
.splash-inner .line {
  display: block;
  width: 34px; height: 1px;
  background: var(--accent);
  margin: 20px auto;
  opacity: .8;
}
.splash-inner p { font-size: 13px; color: #8b939e; letter-spacing: 5px; text-indent: 5px; }
.splash-inner p.sub { font-size: 11px; color: #5b636e; margin-top: 8px; letter-spacing: 3px; }
@keyframes splashIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 分享记录 ---------- */
.hitem {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  margin-bottom: 10px;
}
.hrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hslug {
  font-size: 14px; font-weight: 500;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hmeta { font-size: 12px; color: var(--dim); margin-top: 5px; }
.hnote { font-size: 12px; color: var(--danger); margin-top: 6px; }
.hmanage { display: inline-block; margin-top: 9px; font-size: 13px; color: var(--accent); text-decoration: none; }
.st { font-size: 12px; flex: none; white-space: nowrap; }
.st-0 { color: var(--accent); }
.st-1, .st-2 { color: var(--dim); }
.st-3 { color: var(--danger); }
.st-4 { color: #e6b455; }

/* 记录内联管理 */
.hacts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
button.mini {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
button.mini.danger-m { color: var(--danger); border-color: #3a2622; }
.hlogs { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 6px; }
.hlogs div { font-size: 12px; color: var(--dim); padding: 3px 0; }
.hsummary { font-size: 12px; color: var(--dim); margin: 6px 0 18px; }
.hempty { color: var(--dim); font-size: 13px; text-align: center; padding: 30px 0; }
#more-wrap { padding: 6px 0 24px; }
#more-wrap button { width: 100%; padding: 11px; font-size: 13px; }

/* ---------- 站内提醒 ---------- */
#notice-card { padding: 13px 16px; margin-bottom: 14px; }
.nhead { display: flex; justify-content: space-between; align-items: center; }
.nhead b { font-size: 13px; font-weight: 500; }
.nitem {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; font-size: 13px; color: var(--text);
  text-decoration: none;
}
.nitem + .nitem { border-top: 1px solid var(--line); }
.nitem i { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); flex: none; }
.nitem.nswap i { background: var(--accent); }
.nitem span { flex: 1; }
.nitem em { font-style: normal; font-size: 11px; color: var(--dim); }

.hidden { display: none !important; }

/* ---------- 提示弹窗 ---------- */
.ft-toasts {
  position: fixed; top: 24px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 200; pointer-events: none;
}
.ft-toast {
  max-width: 82vw;
  padding: 11px 20px;
  border-radius: 10px;
  background: #1d232c;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,.45);
  animation: ftIn .22s ease-out both;
}
.ft-toast-err { border-color: #5a3029; color: #f0a297; }
.ft-toast.out { opacity: 0; transform: translateY(-8px); transition: all .32s ease; }
@keyframes ftIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.ft-dialog-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.62);
  display: flex; align-items: center; justify-content: center;
  z-index: 210;
  animation: ftIn .18s ease-out both;
}
.ft-dialog {
  width: 100%; max-width: 300px;
  margin: 0 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 20px 16px;
}
.ft-dialog p { font-size: 14px; line-height: 1.6; color: var(--text); }
.ft-dialog-btns { display: flex; gap: 10px; margin-top: 18px; }
.ft-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
}
.ft-btn.ft-ok { border: none; background: var(--accent); color: #06281a; font-weight: 600; }

/* ---------- 查看页 ---------- */
body.viewer { background: #000; padding: 0; }
body.viewer main { display: contents; }

#cv { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; }

#mask { position: fixed; inset: 0; touch-action: none; }
#bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
#bar i { display: block; height: 100%; width: 100%; background: var(--accent); transition: width .1s linear; }
#hint {
  position: absolute; top: 50%; left: 0; right: 0;
  transform: translateY(-50%);
  text-align: center;
  color: var(--dim);
  font-size: 15px;
  letter-spacing: 2px;
}
#dots {
  position: absolute; bottom: 28px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 8px;
}
#dots i { width: 6px; height: 6px; border-radius: 50%; background: #333a44; }
#dots i.on { background: var(--accent); }

#report {
  position: fixed; top: 14px; right: 14px;
  z-index: 50;
  padding: 6px 12px;
  border: 1px solid #2a2f38;
  border-radius: 999px;
  background: rgba(0,0,0,.4);
  color: #6b7480;
  font-size: 12px;
  cursor: pointer;
}

#back {
  position: fixed; top: 14px; left: 14px;
  z-index: 50;
  padding: 7px 14px;
  border: 1px solid #2a2f38;
  border-radius: 999px;
  background: rgba(0,0,0,.45);
  color: #8b939e;
  font-size: 12px;
  text-decoration: none;
}

#share {
  position: fixed; top: 14px; left: 14px;
  z-index: 50;
  padding: 6px 12px;
  border: 1px solid #2f5a48;
  border-radius: 999px;
  background: rgba(0,0,0,.4);
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
}

/* 内容销毁后：按钮移到屏幕中央促点击 */
#share.center {
  top: 64%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 26px;
  font-size: 14px;
  background: rgba(0,0,0,.55);
  z-index: 55;
}

/* 全屏状态层（加载/已阅/失败）盖在画布上，但必须低于悬浮按钮，
   否则「返回记录」「我也要发一张」会被整块黑底压住看不见 */
.center-msg {
  position: fixed; inset: 0;
  z-index: 40;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; text-align: center;
  background: #000;
}
.center-msg .ghost {
  display: inline-block;
  width: auto;
  margin-top: 10px;
  padding: 11px 26px;
  border-color: #3a4149;
  color: var(--text);
  text-decoration: none;
}
.center-msg b { font-size: 22px; font-weight: 600; }
.center-msg span { font-size: 13px; color: var(--dim); }

/* 换照上传面板 */
#swapup { padding: 24px; }
#swapup .swap-pick { width: 260px; max-width: 100%; padding: 18px 0; }
#swapup button.primary { width: 260px; max-width: 100%; margin-top: 12px; padding: 12px; }
#swap-thumbs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 300px; }
#swap-thumbs img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }

/* ---------- 管理页 ---------- */
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv span { color: var(--dim); }

#logs { list-style: none; }
#logs li { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); padding: 6px 0; border-bottom: 1px solid #1a1e24; }
#logs li b { color: var(--text); font-weight: 400; }

/* 对方回传照片 */
#recv-thumbs { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
#recv-thumbs img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; cursor: zoom-in; }
