/* 婚礼现场互动 H5 —— 移动优先（微信内置浏览器为主） */
:root {
  --bg: #fdf9f6;
  --card: #ffffff;
  --line: #ece4de;
  --text: #2c2622;
  --muted: #96887e;
  --accent: #d9577a;        /* 婚礼粉 */
  --accent-soft: #fdeef2;
  --ok: #10b981;
  --err: #ef4444;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; }
.loading { margin: auto; color: var(--muted); }
.hidden { display: none !important; }

/* ── 通用 ── */
.wrap { max-width: 640px; width: 100%; margin: 0 auto; padding: 18px 16px calc(18px + var(--safe-b)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=password] {
  width: 100%; padding: 12px 14px; font-size: 16px;   /* 16px 防 iOS 聚焦缩放 */
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
  outline: none;
}
input[type=text]:focus, input[type=password]:focus { border-color: var(--accent); }
button {
  font: inherit; border: 0; border-radius: 10px; padding: 12px 16px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
button:disabled { opacity: .5; }
button.ghost { background: var(--accent-soft); color: var(--accent); }
button.plain { background: transparent; color: var(--muted); font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.err { color: var(--err); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ── 头像选择 ── */
.avatar-pick { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.avatar-preview {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  background: var(--accent-soft); border: 1px solid var(--line); flex: none;
}
.avatar-actions { display: flex; flex-direction: column; gap: 8px; }
.avatar-actions button { padding: 8px 12px; font-size: 13px; }

/* ── 主页 ── */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.topbar .who { font-weight: 600; }
.badge {
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 57px; z-index: 4; }
.tabs button {
  flex: 1; background: transparent; color: var(--muted); border-radius: 0;
  padding: 12px 0; font-weight: 600; border-bottom: 2px solid transparent;
}
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.placeholder { text-align: center; color: var(--muted); padding: 40px 16px; }
.placeholder .big { font-size: 30px; margin-bottom: 8px; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }

/* ── 照片墙（M2） ── */
.ph-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.up-btn { background: var(--accent); padding: 10px 16px; font-size: 14px; }
.muted-2 { color: var(--muted); font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tile {
  position: relative; aspect-ratio: 1/1; border-radius: 10px; overflow: hidden;
  background: #f2ece8; cursor: pointer;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .noimg { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 12px; }
.tile .mine, .tile .syncing {
  position: absolute; font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: rgba(0,0,0,.45); color: #fff;
}
.tile .mine { left: 5px; top: 5px; }
.tile .syncing { right: 5px; top: 5px; }
.ph-more { text-align: center; padding: 14px 0; }
.up-progress { margin: 0 0 12px; background: #f2ece8; border-radius: 999px; height: 6px; position: relative; }
.up-progress .bar { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s; }
.up-progress span { position: absolute; right: 0; top: 10px; font-size: 12px; color: var(--muted); }

/* 大图查看 */
.viewer {
  position: fixed; inset: 0; background: #111; z-index: 50;
  display: flex; flex-direction: column; color: #fff;
}
.v-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 13px; }
.v-top img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.v-top .muted-2 { color: #9aa; }
.v-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0 8px; }
.v-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.v-bot { display: flex; align-items: center; gap: 10px; padding: 12px 14px calc(12px + var(--safe-b)); }
.v-bot .muted-2 { color: #9aa; }
.v-btn {
  background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 10px;
  padding: 9px 14px; font-size: 14px; font-weight: 600; text-decoration: none;
}
.v-btn.danger { background: #b91c1c; }
button.plain.v-close { color: #fff; font-size: 18px; }

/* ── 自定义弹窗 / 危险按钮 ── */
button.danger { background: #dc2626; }
button.danger:active { background: #b91c1c; }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-box {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  width: 100%; max-width: 340px; box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.modal-text { font-size: 15px; line-height: 1.6; margin-bottom: 14px; }
.modal-box input { margin-bottom: 4px; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.modal-btns button { padding: 9px 18px; }
.modal-btns .plain { background: transparent; color: var(--muted); }

/* ── 群聊（M3） ── */
body.chat-mode { overflow: hidden; }
body.chat-mode #app { height: 100dvh; }
.pane-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0; }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.msgs {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 12px 6px; display: flex; flex-direction: column; gap: 10px;
}
.bubble { display: flex; gap: 8px; max-width: 82%; cursor: pointer; }
.bubble.me { align-self: flex-end; flex-direction: row-reverse; }
.bubble.other { align-self: flex-start; }
.cava { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.cbody { min-width: 0; }
.cname { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.txt, .cimg, .cap {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 11px; font-size: 15px; line-height: 1.5; word-break: break-word;
}
.bubble.me .txt, .bubble.me .cap { background: var(--accent); color: #fff; border-color: var(--accent); }
.bubble.at-me .txt, .bubble.at-me .cap { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.cimg { padding: 0; max-width: 200px; max-height: 260px; object-fit: cover; display: block; }
.cap { margin-top: 4px; font-size: 14px; }
.at { color: var(--accent); font-weight: 600; }
.bubble.me .at { color: #ffe3ec; }
.ctime { font-size: 11px; color: var(--muted-2); margin-top: 3px; }
.bubble.me .ctime { text-align: right; }
.mute { background: #fff5e6; color: #9a5b00; font-size: 13px; padding: 8px 14px; text-align: center; }
.composer {
  display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px calc(8px + var(--safe-b));
  background: var(--card); border-top: 1px solid var(--line);
  position: relative;                 /* 让表情/@ 面板以输入框为参照（bottom:100% = 贴在它上方） */
}
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; font: inherit; font-size: 16px; line-height: 1.4; max-height: 96px;
  background: #fff; color: var(--text); outline: none;
}
.composer textarea:focus { border-color: var(--accent); }
.composer .ic {
  background: transparent; border: 0; font-size: 20px; padding: 6px 4px; line-height: 1;
}
.composer #send { padding: 9px 14px; font-size: 14px; }
.panel {
  position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 0;
  background: var(--card); border-top: 1px solid var(--line);
  max-height: 200px; overflow-y: auto; padding: 8px;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
}
.panel .em {
  background: transparent; border: 0; font-size: 22px; padding: 5px 0; line-height: 1;
}
#mention { grid-template-columns: repeat(3, 1fr); }
#mention .em { font-size: 14px; padding: 9px 6px; background: var(--accent-soft); color: var(--accent); border-radius: 8px; }

/* 中性提示条（不是错误，别用红字；一开始输入就收起） */
.hint-bar {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-top: 12px;
}
