:root {
  --bg: #fff5f7;
  --card: #ffffff;
  --primary: #e75480;
  --primary-d: #c83e66;
  --text: #2b2b33;
  --muted: #8a8a96;
  --line: #f0d9e0;
  --ok: #2e9e6b;
  --warn: #d98a00;
  --symbol: #b48ead;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  padding-bottom: 72px; transition: background-color .25s ease;
}
header {
  position: sticky; top: 0; z-index: 5; background: var(--primary);
  color: #fff; padding: 14px 16px; font-size: 18px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: background-color .25s ease;
}
header .me { margin-left: auto; font-size: 13px; font-weight: 400; opacity: .9; }
main { padding: 14px; max-width: 640px; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 16px 0 8px; color: var(--primary-d); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); font-size: 13px; }
.big-symbol { font-size: 22px; color: var(--symbol); letter-spacing: 2px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: var(--primary-soft, #ffe3ec); color: var(--primary-d); }
.pill.ok { background: #dff3e8; color: var(--ok); }
.pill.warn { background: #fdf0d8; color: var(--warn); }
button {
  font: inherit; border: none; border-radius: 10px; padding: 10px 14px; cursor: pointer;
  background: var(--primary); color: #fff; font-weight: 600; transition: filter .15s, background-color .25s ease;
}
button:hover { filter: brightness(1.05); }
button:active { filter: brightness(.95); }
button.ghost { background: var(--card); color: var(--primary-d); border: 1px solid var(--line); font-weight: 500; }
button.block { width: 100%; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--text); margin-top: 6px;
}
textarea { resize: vertical; min-height: 64px; word-break: break-all; }
label { font-size: 13px; color: var(--muted); }
.token-box { margin-top: 8px; background: #fff8fa; border: 1px dashed var(--line); border-radius: 10px; padding: 10px; }
.token-box textarea { background: #fff; font-size: 12px; }
.qr { margin: 10px auto; width: 184px; height: 184px; display: flex; align-items: center; justify-content: center; }
.friend { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.friend:last-child { border-bottom: none; }
.friend .name { font-weight: 600; }
.friend .meta { color: var(--muted); font-size: 12px; }
.spacer { flex: 1; }
.msg { margin-top: 10px; font-size: 13px; padding: 8px 10px; border-radius: 8px; }
.msg.ok { background: #eafaf1; color: var(--ok); }
.msg.err { background: #fdeaea; color: #c0392b; }
nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  max-width: 640px; margin: 0 auto;
}
nav button {
  flex: 1; background: none; color: var(--muted); border-radius: 0; padding: 8px 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500;
}
nav button.active { color: var(--primary); }
nav .ico { font-size: 20px; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 360px; }
.modal h2 { margin-top: 0; }
.hidden { display: none !important; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }

/* 扫码弹窗里的视频预览 */
#scanVideo { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #000; border-radius: 10px; margin-top: 8px; }

/* 图片灯箱 */
#lightbox { background: rgba(0,0,0,.92); padding: 0; }
#lightboxImg { max-width: 100%; max-height: 100%; object-fit: contain; }

/* 日记图片 */
.diary-imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.diary-imgs img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.img-preview { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.img-preview .thumb { position: relative; }
.img-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.img-preview .del { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; background: #c0392b; color: #fff; font-size: 12px; line-height: 20px; text-align: center; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.3); }

/* 一键体验 Demo 入口 */
.card.demo-hint { border: 2px dashed var(--primary); background: #fff6f9; }
.card.demo-hint button { margin-top: 10px; }
.demo-inline { margin-top: 12px; }

/* 好友列表头部 + 右上角加好友按钮 */
.friends-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.add-friend-btn { background: var(--primary); color: #fff; padding: 6px 14px; font-size: 13px; border-radius: 999px; font-weight: 600; white-space: nowrap; transition: filter .15s, background-color .25s ease; }
.add-friend-btn:hover { filter: brightness(1.05); }
.add-friend-btn:active { filter: brightness(.95); }

/* 加好友弹窗（三种模式） */
.add-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.add-close { padding: 4px 12px; font-size: 16px; line-height: 1; border-radius: 10px; }
.add-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.add-tab { flex: 1; background: var(--card); color: var(--primary-d); border: 1px solid var(--line); padding: 8px 4px; font-size: 13px; border-radius: 10px; font-weight: 500; transition: background-color .15s, color .15s; }
.add-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.add-body .qr { width: 200px; height: 200px; }
.add-body .token-box { margin-top: 10px; }


/* ---------- 偶像栏目 ---------- */
.idol-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.idol-head button { background: var(--primary); color: #fff; padding: 6px 14px; font-size: 13px; border-radius: 999px; font-weight: 600; white-space: nowrap; transition: filter .15s, background-color .25s ease; }
.idol-head button:active { filter: brightness(.95); }
.idol-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.idol-card { width: calc(50% - 6px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04); cursor: pointer; }
.idol-photo { box-sizing: border-box; width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: #f3f3f5; display: flex; align-items: center; justify-content: center; }
.idol-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.idol-photo.empty { color: var(--muted); font-size: 12px; }
.idol-photo.lg { width: 160px; height: 160px; margin: 0 auto; cursor: pointer; }
.idol-photo-wrap { text-align: center; }
.idol-name { font-weight: 600; margin-top: 8px; }
/* 装饰框（免费版仅 1 个；会员多框为预留） */
.frame-pink    { border: 4px solid #ff9ec4; }
.frame-gold    { border: 4px solid #d4af37; box-shadow: 0 0 0 2px #fff inset; }
.frame-heart   { border: 4px dashed #ff5b8d; }
.frame-star    { border: 4px solid #7c5cff; }
.frame-polaroid{ border: 8px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18); background: #fff; }
.locked-slot { margin-top: 10px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 12px; text-align: center; background: #fafafa; }
.frame-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.frame-opt { background: var(--card); color: var(--primary-d); border: 1px solid var(--line); padding: 8px 12px; font-size: 13px; border-radius: 10px; font-weight: 500; transition: background-color .15s, color .15s; }
.frame-opt.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.act-item { border-top: 1px solid var(--line); padding: 10px 0; }
.act-item:first-of-type { border-top: none; }
.act-top { display: flex; align-items: center; justify-content: space-between; }
.act-date { font-weight: 600; font-size: 13px; }
.act-title { margin-top: 4px; font-weight: 500; }
.act-detail { margin-top: 4px; color: var(--muted); white-space: pre-wrap; }
.act-item .del { background: var(--card); color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; font-size: 12px; border-radius: 8px; }
#idolModal .row button { flex: 1; }

/* ---------- 界面风格（名片页切换，body[data-style] 驱动）---------- */
/* 常规：不覆盖，沿用上方颜色主题。以下仅定义赛博朋克 / 浪漫漫画。 */

/* ===== 赛博朋克 ===== */
body[data-style="cyberpunk"] {
  --bg: #07070f;
  --card: #0f0f1c;
  --primary: #00e5ff;
  --primary-d: #00b3cc;
  --primary-soft: #0a2a33;
  --text: #d7e6ff;
  --muted: #6f7aa8;
  --line: #243049;
  --symbol: #ff2bd6;
  --ok: #39ff14;
  --warn: #ffd400;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", "Courier New", monospace;
  background-image:
    linear-gradient(rgba(0,229,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,.045) 1px, transparent 1px);
  background-size: 26px 26px;
}
body[data-style="cyberpunk"] header {
  background: linear-gradient(90deg, #07070f 0%, #0c1b2e 55%, #1a0b2e 100%);
  color: #00e5ff; text-shadow: 0 0 8px rgba(0,229,255,.7);
  border-bottom: 1px solid rgba(0,229,255,.35);
  box-shadow: 0 0 16px rgba(0,229,255,.35);
  letter-spacing: 1px;
}
body[data-style="cyberpunk"] .card,
body[data-style="cyberpunk"] .modal {
  background: var(--card); border: 1px solid #243049; border-radius: 6px;
  box-shadow: 0 0 12px rgba(0,229,255,.10), inset 0 0 18px rgba(0,229,255,.04);
}
body[data-style="cyberpunk"] h3 { color: #00e5ff; }
body[data-style="cyberpunk"] button {
  background: transparent; color: #00e5ff; border: 1px solid #00e5ff; border-radius: 4px;
  box-shadow: 0 0 8px rgba(0,229,255,.35);
}
body[data-style="cyberpunk"] button:hover { background: rgba(0,229,255,.12); }
body[data-style="cyberpunk"] button.ghost {
  background: transparent; color: #ff2bd6; border: 1px solid #ff2bd6;
  box-shadow: 0 0 8px rgba(255,43,214,.3);
}
body[data-style="cyberpunk"] input,
body[data-style="cyberpunk"] select,
body[data-style="cyberpunk"] textarea {
  background: #0a0a16; color: #d7e6ff; border: 1px solid #243049; border-radius: 4px;
}
body[data-style="cyberpunk"] .pill { background: #0a2a33; color: #00e5ff; }
body[data-style="cyberpunk"] .pill.ok { background: #0a2a14; color: #39ff14; }
body[data-style="cyberpunk"] .pill.warn { background: #2a260a; color: #ffd400; }
body[data-style="cyberpunk"] nav {
  background: #0a0a16; border-top: 1px solid rgba(0,229,255,.35);
  box-shadow: 0 -2px 16px rgba(0,229,255,.2);
}
body[data-style="cyberpunk"] nav button { color: #6f7aa8; }
body[data-style="cyberpunk"] nav button.active {
  color: #00e5ff; text-shadow: 0 0 8px rgba(0,229,255,.7);
}
body[data-style="cyberpunk"] .friend { border-bottom: 1px solid #1c2438; }
body[data-style="cyberpunk"] .friend .name { color: #d7e6ff; }
body[data-style="cyberpunk"] .idol-card { background: var(--card); border: 1px solid #243049; border-radius: 6px; box-shadow: 0 0 10px rgba(0,229,255,.10); }
body[data-style="cyberpunk"] .token-box { background: #0a0a16; border: 1px dashed #243049; }
body[data-style="cyberpunk"] .frame-opt { color: #00e5ff; border: 1px solid #243049; }
body[data-style="cyberpunk"] .frame-opt.active { background: #00e5ff; color: #07070f; }
body[data-style="cyberpunk"] .add-friend-btn,
body[data-style="cyberpunk"] .idol-head button { background: transparent; color: #00e5ff; border: 1px solid #00e5ff; box-shadow: 0 0 8px rgba(0,229,255,.35); }

/* ===== 浪漫漫画 ===== */
body[data-style="romance"] {
  --bg: #fff0f6;
  --card: #ffffff;
  --primary: #ff6f91;
  --primary-d: #e84d72;
  --primary-soft: #ffe3ec;
  --text: #4a3340;
  --muted: #b08a9a;
  --line: #ffd0e0;
  --symbol: #ff9ec4;
  --ok: #2e9e6b;
  --warn: #e89b00;
  font-family: "Yuanti SC", "PingFang SC", "Microsoft YaHei", "Comic Sans MS", cursive, sans-serif;
  background-image:
    radial-gradient(circle at 12% 18%, #ffe3ee 0, transparent 42%),
    radial-gradient(circle at 88% 8%, #ffe9f3 0, transparent 38%);
}
body[data-style="romance"] header {
  background: linear-gradient(90deg, #ff9ec4 0%, #ffc2d8 100%);
  color: #fff; text-shadow: 0 1px 2px rgba(232,77,114,.4);
  border-bottom: 3px solid #ffd0e0; border-radius: 0 0 18px 18px;
  box-shadow: 0 4px 14px rgba(255,111,145,.25);
}
body[data-style="romance"] .card,
body[data-style="romance"] .modal {
  background: #fff; border: 2px solid #ff9ec4; border-radius: 20px;
  box-shadow: 3px 3px 0 #ffd0e0;
}
body[data-style="romance"] h3 { color: #e84d72; }
body[data-style="romance"] button {
  background: linear-gradient(180deg, #ff85a8, #ff6f91); color: #fff;
  border: 2px solid #ff9ec4; border-radius: 999px; box-shadow: 0 3px 0 #e84d72; font-weight: 700;
}
body[data-style="romance"] button:active { box-shadow: 0 1px 0 #e84d72; transform: translateY(2px); }
body[data-style="romance"] button.ghost {
  background: #fff; color: #e84d72; border: 2px solid #ff9ec4; box-shadow: 2px 2px 0 #ffd0e0;
}
body[data-style="romance"] input,
body[data-style="romance"] select,
body[data-style="romance"] textarea {
  background: #fff7fb; color: #4a3340; border: 2px solid #ffd0e0; border-radius: 14px;
}
body[data-style="romance"] .pill { background: #ffe3ec; color: #e84d72; border-radius: 999px; }
body[data-style="romance"] nav {
  background: #fff; border-top: 3px solid #ffd0e0;
  box-shadow: 0 -4px 14px rgba(255,111,145,.15); border-radius: 18px 18px 0 0;
}
body[data-style="romance"] nav button { color: #b08a9a; border-radius: 14px; }
body[data-style="romance"] nav button.active {
  color: #fff; background: linear-gradient(180deg, #ff85a8, #ff6f91);
  box-shadow: 0 2px 0 #e84d72;
}
body[data-style="romance"] .friend { border-bottom: 2px dashed #ffd0e0; }
body[data-style="romance"] .idol-card {
  background: #fff; border: 2px solid #ff9ec4; border-radius: 20px; box-shadow: 3px 3px 0 #ffd0e0;
}
body[data-style="romance"] .token-box { background: #fff7fb; border: 2px dashed #ff9ec4; border-radius: 14px; }
body[data-style="romance"] .frame-opt { color: #e84d72; border: 2px solid #ffd0e0; }
body[data-style="romance"] .frame-opt.active { background: #ff6f91; color: #fff; border-color: #ff6f91; }
body[data-style="romance"] .add-friend-btn,
body[data-style="romance"] .idol-head button {
  background: linear-gradient(180deg, #ff85a8, #ff6f91); color: #fff;
  border: 2px solid #ff9ec4; box-shadow: 0 3px 0 #e84d72;
}

/* ---------- 声明与条款（注册页 / 名片页底部）---------- */
.legal-note {
  font-size: 11px; line-height: 1.65; color: var(--muted);
  margin-top: 14px; text-align: justify;
}
#nickModal .legal-note { margin-top: 12px; }
.legal-footer {
  background: transparent; border: none; box-shadow: none;
  padding: 18px 4px 4px;
}
.legal-footer h2 {
  font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px;
}
body[data-style="cyberpunk"] .legal-footer { background: transparent; border: none; box-shadow: none; }
body[data-style="romance"] .legal-footer { background: transparent; border: none; box-shadow: none; }

/* ---------- 注册同意 / 文档查看 ---------- */
.reg-docs { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.reg-docs .link { background: none; color: var(--primary-d); border: none; padding: 0; font-size: 13px; font-weight: 500; text-decoration: underline; cursor: pointer; }
.reg-docs .reg-sep { color: var(--muted); }
.agree-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text); line-height: 1.5; }
.agree-row input[type=checkbox] { width: auto; margin: 3px 0 0; flex: 0 0 auto; }
.agree-row .link-inline { background: none; border: none; padding: 0; color: var(--primary-d); font-size: 13px; text-decoration: underline; cursor: pointer; font-weight: 500; }
button.danger { background: #c0392b; color: #fff; }
button.danger:hover { filter: brightness(1.05); }
button.ghost.danger-text { color: #c0392b; border-color: #f0c4c4; }
#loginNick { color: var(--primary-d); }
#loginPwWrap[style*="none"] { display: none; }
/* 文档弹窗 */
.doc-modal { max-width: 420px; max-height: 82vh; display: flex; flex-direction: column; }
.doc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.doc-lang { display: flex; gap: 6px; margin-bottom: 10px; }
.lang-btn { flex: 0 0 auto; background: var(--card); color: var(--primary-d); border: 1px solid var(--line); padding: 6px 14px; font-size: 13px; border-radius: 999px; }
.lang-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.doc-content { overflow-y: auto; font-size: 13.5px; line-height: 1.7; text-align: left; }
.doc-content h2 { font-size: 17px; margin: 0 0 10px; text-align: left; }
.doc-content h3 { font-size: 14px; margin: 16px 0 6px; color: var(--primary-d); text-align: left; }
.doc-content p { margin: 6px 0; text-align: left; }
.doc-content ul, .doc-content ol { margin: 6px 0; padding-left: 20px; text-align: left; }
.doc-content li { margin: 4px 0; }
.doc-content .doc-meta { color: var(--muted); font-size: 12px; margin: -4px 0 8px; text-align: left; }

/* 滑动开关（本机登录密码） */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; margin: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--line); border-radius: 999px; transition: background-color .2s ease;
}
.switch .slider::before {
  content: ""; position: absolute; height: 22px; width: 22px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(22px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--primary-d); outline-offset: 2px; }
.pw-switch-row { display: flex; align-items: center; justify-content: space-between; }
.pw-switch-row .pw-switch-label { font-size: 14px; font-weight: 500; }
