* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #f3f4f8;
  --card: #ffffff;
  --primary: #5b6cff;
  --primary-dark: #4858e6;
  --win: #22c55e;
  --win-dark: #16a34a;
  --danger: #ef4444;
  --text: #1a1a1a;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --line: #e5e7eb;
  --gold: #fbbf24;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #eef0ff 0%, #f3f4f8 30%);
  color: var(--text);
  min-height: 100vh;
}
#app { max-width: 480px; margin: 0 auto; padding: 14px 14px 80px; }

.card { background: var(--card); border-radius: 14px; padding: 16px; margin: 12px 0; box-shadow: 0 2px 8px rgba(91,108,255,.06); }
.tabs { display: flex; gap: 6px; background: #eef0f6; padding: 4px; border-radius: 10px; margin-bottom: 12px; }
.tabs button { flex: 1; padding: 9px 0; border: none; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 500; transition: all .15s; }
.tabs button.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
input {
  width: 100%; padding: 12px 14px; margin: 6px 0;
  border: 1px solid var(--line); border-radius: 10px; font-size: 15px; background: #fff;
  transition: border-color .15s;
}
input:focus { outline: none; border-color: var(--primary); }
label { display: block; font-size: 12px; color: var(--text-2); margin-top: 8px; }
label input { margin-top: 4px; }
button.primary {
  width: 100%; padding: 13px; border: none; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 600; margin-top: 8px;
  transition: all .15s;
}
button.primary:active { background: var(--primary-dark); transform: scale(.98); }
button.ghost {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text-2); font-size: 14px; font-weight: 500;
}
button.ghost:active { background: #f3f4f6; }
button.full-btn { width: 100%; padding: 12px; margin: 0 0 12px; }

.hero { text-align: center; padding: 30px 0 20px; }
.logo { font-size: 48px; margin-bottom: 6px; }
.hero h1 { font-size: 26px; margin: 0 0 6px; font-weight: 700; }
.hero .sub { font-size: 14px; color: var(--text-2); margin: 0; }
.auth-card { margin-top: 10px; }

/* 我的卡片 */
.me-card { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.me-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 600; flex-shrink: 0; }
.me-info { flex: 1; min-width: 0; }
.me-name { font-size: 16px; font-weight: 600; line-height: 1.2; }
.me-balance { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.bal-label { font-size: 11px; color: var(--text-2); }
.bal-amt { font-size: 22px; font-weight: 700; font-family: ui-monospace, monospace; color: var(--text); }
.bal-amt.pos { color: var(--win-dark); }
.bal-amt.neg { color: var(--danger); }

/* 余额编辑 */
.balance-edit { padding: 12px 14px; }
.be-title { font-size: 13px; color: var(--text-2); font-weight: 600; margin-bottom: 8px; }
.be-row { display: flex; gap: 8px; align-items: center; }
.be-row input { flex: 1; margin: 0; font-size: 17px; font-weight: 600; font-family: ui-monospace, monospace; }

h2 { font-size: 17px; margin: 16px 0 10px; font-weight: 600; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list .item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
  transition: all .15s;
}
.list .item:active { transform: scale(.98); box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.list .item .arrow { color: var(--text-3); font-size: 18px; }
.list .item small { color: var(--text-3); font-size: 12px; margin-left: 6px; }
.empty { color: var(--text-3); font-size: 13px; text-align: center; padding: 16px; background: var(--card); border-radius: 10px; border: 1px dashed var(--line); }

/* 房间头部 */
.room-head { display: flex; align-items: center; gap: 12px; padding: 6px 0 12px; }
.room-meta { flex: 1; min-width: 0; }
.room-name { font-size: 19px; font-weight: 700; line-height: 1.2; }
.room-no-wrap { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.room-no-label { font-size: 11px; color: var(--text-3); }
.room-no { background: #eef0f6; padding: 3px 10px; border-radius: 6px; font-size: 14px; color: var(--primary); font-weight: 600; letter-spacing: 1px; cursor: pointer; font-family: ui-monospace, monospace; }
.room-tabs { margin-bottom: 14px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-card { background: var(--card); border-radius: 12px; padding: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.04); }
.stat-card.mine { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; }
.stat-card.mine .stat-label { color: rgba(255,255,255,.85); }
.stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.stat-val { font-size: 26px; font-weight: 700; font-family: ui-monospace, monospace; }

/* 成员 */
.section { background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.04); }
.section-title { font-size: 13px; color: var(--text-2); font-weight: 600; margin-bottom: 10px; }
.member-list { display: flex; flex-direction: column; gap: 6px; }
.member-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 4px;
  border-bottom: 1px solid #f3f4f6;
}
.member-row:last-child { border-bottom: none; }
.member-row .av { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; color: #fff; flex-shrink: 0; }
.member-row .info { flex: 1; min-width: 0; }
.member-row .name { font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.member-row .me-tag { background: var(--primary); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.member-row .this-round { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.member-row .nums { text-align: right; flex-shrink: 0; }
.member-row .bal { font-size: 18px; font-weight: 700; font-family: ui-monospace, monospace; color: var(--text); }
.member-row .bal.pos { color: var(--win-dark); }
.member-row .bal.neg { color: var(--danger); }
.member-row .contrib { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.member-row .contrib.has { color: var(--gold); font-weight: 600; }

/* 本轮出资 */
.contrib-list { display: flex; flex-direction: column; gap: 6px; }
.contrib-row-list {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 4px; border-bottom: 1px solid #f3f4f6;
}
.contrib-row-list:last-child { border-bottom: none; }
.contrib-row-list .left { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.contrib-row-list .right { font-weight: 700; color: var(--gold); font-family: ui-monospace, monospace; font-size: 16px; }

/* 操作 */
.actions.contrib-row { display: flex; gap: 8px; margin: 0 0 8px; }
.actions.contrib-row input { margin: 0; flex: 1; font-size: 17px; font-weight: 600; font-family: ui-monospace, monospace; }
.contrib-btn { width: auto !important; padding: 12px 20px !important; margin: 0 !important; flex-shrink: 0; }
.quick-row { display: flex; gap: 6px; margin-bottom: 14px; }
.chip { flex: 1; padding: 8px 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--primary); font-size: 13px; font-weight: 600; }
.chip:active { background: #eef0ff; }

.settle-btn {
  width: 100%; padding: 15px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--win) 0%, var(--win-dark) 100%);
  color: #fff; font-size: 16px; font-weight: 700; margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(34,197,94,.25);
}
.settle-btn:active { transform: scale(.98); }
.cancel-btn { width: 100%; margin-top: 0; }

.history-item {
  background: var(--card); border-radius: 12px; padding: 12px 14px;
  margin-bottom: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.history-item .h-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.history-item .h-round { font-size: 13px; color: var(--text-2); font-weight: 600; }
.history-item .h-winner { font-size: 13px; color: var(--win-dark); font-weight: 600; }
.history-item .h-body { font-size: 13px; color: var(--text-2); }
.history-item .h-body .who { color: var(--text); font-weight: 500; }

#toast {
  position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.85); color: #fff; padding: 10px 18px;
  border-radius: 8px; font-size: 14px; opacity: 0;
  transition: opacity .25s; pointer-events: none; z-index: 999;
  white-space: nowrap;
}
#toast.show { opacity: 1; }

.msg { font-size: 13px; margin: 8px 0 0; min-height: 16px; text-align: center; color: var(--text-2); }
.msg.err { color: var(--danger); }
.hint { font-size: 12px; color: var(--text-3); text-align: center; }
#chart { width: 100%; max-width: 340px; display: block; margin: 8px auto 0; }
