/* 爽骂 · 黑白简约（与《高性价比人生指南》配套：浅灰底、白卡片、黑字、圆角） */
:root {
  --bg: #f2f2f2;
  --card: #ffffff;
  --text: #111111;
  --muted: #777777;
  --border: #e3e3e3;
  --accent: #111111;
  --accent-text: #ffffff;
  --bubble-own: #111111;
  --bubble-own-text: #ffffff;
  --bubble-opp: #ffffff;
  --danger: #b3261e;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --card: #1d1d1d;
    --text: #f2f2f2;
    --muted: #9a9a9a;
    --border: #333333;
    --accent: #f2f2f2;
    --accent-text: #111111;
    --bubble-own: #f2f2f2;
    --bubble-own-text: #111111;
    --bubble-opp: #1d1d1d;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 640px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

#topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 8px;
}
.brand { display: flex; align-items: baseline; gap: 6px; font-weight: 800; }
.brand-mark { font-size: 20px; }
.brand-name { font-size: 20px; }
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.level-chip {
  margin-left: auto; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  font-size: 18px; padding: 6px 9px; color: var(--text);
}
.icon-btn.big { font-size: 22px; padding: 8px 11px; }
.icon-btn.small { font-size: 14px; padding: 3px 7px; }

#modeTabs { display: flex; gap: 8px; padding: 0 14px; }
.mode-tab {
  flex: 1; padding: 9px 4px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 14px; font-weight: 700;
}
.mode-tab.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
#modeHint { text-align: center; font-size: 12px; color: var(--muted); padding: 7px 14px 2px; }

#chatWrap { flex: 1; display: flex; flex-direction: column; padding: 8px 14px 4px; overflow: hidden; }
#chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 0 10px; }
#emptyTip { text-align: center; color: var(--muted); margin: auto 0; }
.empty-big { font-size: 18px; font-weight: 800; color: var(--text); margin: 0 0 6px; }
.empty-small { font-size: 13px; line-height: 1.8; margin: 0; }
.sym { font-weight: 700; color: var(--text); }

.msg { display: flex; gap: 8px; max-width: 92%; animation: popIn .18s ease; }
.msg.own { align-self: flex-end; flex-direction: row-reverse; }
.msg.opp { align-self: flex-start; }
@keyframes popIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  overflow: hidden; padding: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.soiled { filter: grayscale(1) brightness(.55) sepia(.4); }
.avatar .flag { font-size: 18px; }
.msg-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.msg-name { font-size: 11px; color: var(--muted); }
.bubble {
  padding: 9px 13px; border-radius: var(--radius); line-height: 1.6; font-size: 15px;
  word-break: break-all; background: var(--bubble-opp); border: 1px solid var(--border);
}
.msg.own .bubble { background: var(--bubble-own); color: var(--bubble-own-text); border-color: var(--bubble-own); border-bottom-right-radius: 4px; }
.msg.opp .bubble { border-bottom-left-radius: 4px; }
.bubble.exploding { animation: shake .3s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px) rotate(-2deg); } 75% { transform: translateX(4px) rotate(2deg); } }
.bubble.gone { visibility: hidden; }
.msg .peek { font-size: 11px; color: var(--muted); }

#detoBar, #detoDone { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 6px 0; }
#detoCount { font-size: 13px; font-weight: 700; }
.btn-dark {
  background: var(--accent); color: var(--accent-text); border: 1px solid var(--accent);
  border-radius: 999px; padding: 9px 16px; font-size: 14px; font-weight: 700;
}
.btn-ghost {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 999px; padding: 9px 16px; font-size: 14px; font-weight: 700;
}
.btn-ghost.small { padding: 5px 10px; font-size: 12px; }
.btn-ghost.danger { color: var(--danger); border-color: var(--danger); }
.btn-ghost:disabled, .btn-dark:disabled { opacity: .45; }

#propsPanel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  margin: 0 14px 8px; padding: 10px 12px;
}
.props-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.props-head #comboLabel { margin-left: auto; font-size: 13px; }
.props-row { display: flex; gap: 8px; margin-top: 10px; }
.prop-btn {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 2px 6px; font-size: 13px; color: var(--text); user-select: none; -webkit-user-select: none;
}
.prop-btn .prop-ico { font-size: 26px; display: block; }
.prop-btn .prop-count { font-size: 11px; color: var(--muted); }
.prop-btn.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.anger-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; }
.anger-bar { flex: 1; height: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
#angerFill { height: 100%; width: 0%; background: var(--text); transition: width .3s; }
.throw-hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }

#voiceBar { margin: 0 14px 8px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
#voiceBars { display: flex; align-items: flex-end; gap: 2px; height: 44px; }
#voiceBars i { flex: 1; background: #bbb; border-radius: 2px; height: 6px; min-height: 4px; transition: height .06s linear, background .06s linear; }
#voiceStatus { text-align: center; font-size: 12px; color: var(--muted); margin-top: 6px; }
#voiceStatus.err { color: var(--danger); }

#inputBar {
  display: flex; gap: 8px; align-items: flex-end; padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg);
}
#input {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); color: var(--text); padding: 10px 12px; font-size: 15px; line-height: 1.5;
  max-height: 120px; outline: none;
}
.enter-hint { font-size: 11px; color: var(--muted); white-space: nowrap; padding-bottom: 10px; }

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-text); padding: 8px 16px; border-radius: 999px;
  font-size: 13px; z-index: 60; max-width: 86%; text-align: center;
}

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: var(--card); color: var(--text); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 640px; max-height: 88dvh; overflow-y: auto; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
}
.modal-card.wide { max-height: 92dvh; }
.modal-card h2 { margin: 0 0 12px; font-size: 18px; }
.modal-card h3 { margin: 14px 0 8px; font-size: 14px; }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.modal-actions .btn-dark, .modal-actions .btn-ghost { flex: 1; }
.fine-print { font-size: 12px; color: var(--muted); line-height: 1.6; }
.report-stats { display: flex; gap: 8px; text-align: center; }
.report-stats > div { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px 4px; }
.report-stats b { font-size: 26px; display: block; }
.report-stats span { font-size: 12px; color: var(--muted); }
.level-progress { margin-top: 12px; }
.lp-line { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.lp-bar { height: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; margin-top: 6px; overflow: hidden; }
#rLevelFill { height: 100%; width: 0%; background: var(--text); }
.save-prompt { margin: 14px 0 0; font-size: 14px; font-weight: 700; }
.local-tag { font-size: 11px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; color: var(--muted); font-weight: 400; }
.tabs-mini { display: flex; gap: 8px; margin-bottom: 10px; }
.mini-tab { flex: 1; padding: 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-weight: 700; }
.mini-tab.active { background: var(--accent); color: var(--accent-text); }
.board-list { list-style: none; margin: 0; padding: 0; }
.board-list li { display: flex; gap: 8px; padding: 10px 4px; border-bottom: 1px solid var(--border); font-size: 14px; align-items: center; }
.board-list .rank { font-weight: 800; width: 28px; }
.board-list .bname { flex: 1; font-weight: 700; }
.board-list .blevel { font-size: 11px; color: var(--muted); }
.my-board { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-top: 10px; font-size: 13px; line-height: 1.7; }

.set-group { border-top: 1px solid var(--border); padding-top: 4px; }
.set-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; flex-wrap: wrap; }
.set-row input[type="text"], .set-row select { flex: 1; min-width: 120px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); font-size: 14px; }
.switch-row { justify-content: space-between; }
.btn-row .seg-btn { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px; padding: 7px 12px; font-weight: 700; }
.seg-btn.active { background: var(--accent); color: var(--accent-text); }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 8px 0; }
.avatar-grid .avatar { width: 100%; aspect-ratio: 1; height: auto; font-size: 26px; }
.avatar-grid .avatar.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.sound-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sound-opt { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 12px; padding: 10px 6px; font-size: 14px; font-weight: 700; }
.sound-opt.active { background: var(--accent); color: var(--accent-text); }
.records-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; font-size: 13px; }
.records-tools select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); }
.records-list { list-style: none; margin: 0; padding: 0; }
.records-list li { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; line-height: 1.7; }
.records-list .rec-head { display: flex; justify-content: space-between; font-weight: 700; }
.records-list .rec-body { color: var(--muted); white-space: pre-wrap; word-break: break-all; max-height: 120px; overflow: hidden; }
.records-list .rec-tools { display: flex; gap: 6px; margin-top: 6px; }

#fxLayer { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.shard {
  position: absolute; background: #222; border-radius: 2px; pointer-events: none;
}
.smoke {
  position: absolute; border-radius: 50%; background: rgba(120,120,120,.45); pointer-events: none;
}
.ring {
  position: absolute; border: 3px solid #999; border-radius: 50%; pointer-events: none;
}
.fly-item { position: fixed; z-index: 80; font-size: 34px; pointer-events: none; }
body.shake { animation: bodyShake .3s ease; }
@keyframes bodyShake { 0%,100% { transform: translate(0,0); } 20% { transform: translate(-4px,2px); } 40% { transform: translate(4px,-2px); } 60% { transform: translate(-3px,-2px); } 80% { transform: translate(3px,2px); } }
@media (prefers-color-scheme: dark) { .shard { background: #ddd; } .smoke { background: rgba(200,200,200,.35); } }
