/* ===== 记分台 移动端样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #1a2332;
  --card: #243148;
  --card2: #2c3a54;
  --line: #35456a;
  --text: #e8edf6;
  --muted: #8fa0bd;
  --gold: #e8b64c;
  --green: #3ecf8e;
  --red: #ff5c5c;
  --blue: #4d9fff;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* ---- 语音播报 ---- */
.voice-card { padding: 12px 16px; }
.voice-row { display: flex; align-items: center; justify-content: space-between; }
.voice-label { font-size: 14px; font-weight: 600; }
.voice-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.btn-mini.on { color: var(--green); border-color: rgba(62,207,142,.4); }
.btn-mini.off { color: var(--muted); }

/* ---- 登录页 ---- */
.center-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 26px 28px;
  text-align: center;
}
.logo { font-size: 30px; font-weight: 800; letter-spacing: 2px; color: var(--gold); }
.sub { color: var(--muted); font-size: 13px; margin: 12px 0 24px; }
.login-card input {
  width: 100%; padding: 13px 14px; font-size: 16px;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  outline: none; margin-bottom: 14px;
}
.login-card input:focus { border-color: var(--gold); }

/* ---- 顶栏 ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(26,35,50,.96); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
}
.topbar-title { font-size: 17px; font-weight: 700; flex: 1; }
.topbar-back { color: var(--muted); font-size: 26px; line-height: 1; text-decoration: none; padding-right: 4px; }
.topbar-user { color: var(--muted); font-size: 13px; }
.logout { color: var(--red); text-decoration: none; margin-left: 8px; }

/* ---- 页面容器 ---- */
.page { max-width: 640px; margin: 0 auto; padding: 14px 14px 60px; }

/* ---- 卡片 ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.sub-note { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---- 按钮 ---- */
.btn-primary {
  background: linear-gradient(135deg, #f0c469, #e8b64c);
  color: #2a2108; border: none; font-weight: 700;
  border-radius: 10px; padding: 12px 18px; font-size: 15px;
  cursor: pointer;
}
.btn-primary:disabled { opacity: .5; }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 14px; font-size: 16px; border-radius: 12px; }
.btn-ghost {
  background: transparent; color: var(--blue);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 18px; font-size: 15px; cursor: pointer;
}
.btn-danger { background: rgba(255,92,92,.12); color: var(--red); border: 1px solid rgba(255,92,92,.4); border-radius: 10px; padding: 12px 18px; font-size: 15px; cursor: pointer; }
.btn-mini { background: transparent; color: var(--blue); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.btn-cancel { margin-top: 12px; width: 100%; background: var(--card2); color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 15px; cursor: pointer; }
.btn-nav { display: block; width: 100%; text-align: center; text-decoration: none; background: transparent; color: var(--blue); border: 1px solid var(--line); border-radius: 10px; padding: 13px; font-size: 15px; margin-bottom: 14px; }
.btn-nav-row { display: flex; gap: 10px; margin-bottom: 14px; }
.btn-nav-row .btn-nav { margin-bottom: 0; flex: 1; }

/* ---- 管理后台 ---- */
.err { color: var(--red); font-size: 13px; margin: 8px 0; text-align: center; }
.admin-msg { background: rgba(62,207,142,.12); color: var(--green); border: 1px solid rgba(62,207,142,.3); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.admin-err { background: rgba(255,92,92,.12); color: var(--red); border: 1px solid rgba(255,92,92,.3); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.page input[type=password], .page input[type=text] {
  width: 100%; box-sizing: border-box; padding: 13px 14px; font-size: 16px;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; outline: none; margin-bottom: 14px;
}
.page input:focus { border-color: var(--gold); }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-item { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.admin-item.disabled { opacity: .55; }
.admin-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-nick { font-weight: 700; font-size: 16px; }
.admin-sub { color: var(--muted); font-size: 12px; margin: 6px 0 10px; }
.admin-ops { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-ops form { margin: 0; }
.admin-pwd { font-size: 13px; color: var(--text); background: rgba(0,0,0,.25); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; word-break: break-all; font-family: Consolas, Monaco, monospace; }
.admin-setpwd { margin-bottom: 10px; }
.admin-setpwd input { width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 15px; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; outline: none; margin-bottom: 8px; }
.admin-setpwd-ops { display: flex; gap: 8px; }

/* ---- 台费结算模拟器 ---- */
.sim-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.sim-row:last-of-type { border-bottom: none; }
.sim-label { font-size: 14px; color: var(--text); }
.sim-val { font-size: 16px; font-weight: 700; color: var(--gold); }
.sim-row input { width: 130px; text-align: right; padding: 8px 10px; font-size: 15px; background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; outline: none; }
.sim-row input:focus { border-color: var(--gold); }
.sim-result { margin-top: 12px; background: rgba(232,182,76,.08); border: 1px solid rgba(232,182,76,.25); border-radius: 10px; padding: 12px; }
.sim-title { font-size: 13px; color: var(--gold); margin-bottom: 8px; font-weight: 600; }
.sim-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 14px; border-bottom: 1px dashed rgba(232,182,76,.15); }
.sim-item:last-child { border-bottom: none; }
.sim-item b { color: var(--green); }
.sim-item b.pos { color: var(--red); }
.sim-item b.neg { color: var(--green); }
.sim-item b.even { color: var(--muted); }
.sim-final { margin-top: 12px; background: rgba(77,159,255,.08); border: 1px solid rgba(77,159,255,.25); border-radius: 10px; padding: 12px; }
.sim-final-title { font-size: 13px; color: var(--blue); margin-bottom: 8px; font-weight: 600; }

/* ---- 加入 ---- */
.join-card .join-row { display: flex; gap: 10px; }
.join-row input {
  flex: 1; padding: 12px 14px; font-size: 16px;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.join-row input:focus { border-color: var(--gold); }

/* ---- 房间列表 ---- */
.room-list .room-item {
  display: block; padding: 12px 2px;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text);
}
.room-list .room-item:last-child { border-bottom: none; }
.room-code { font-size: 18px; font-weight: 800; letter-spacing: 3px; color: var(--gold); margin-right: 10px; }
.room-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---- 标签 ---- */
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.tag-live { background: rgba(62,207,142,.15); color: var(--green); }
.tag-done { background: rgba(143,160,189,.15); color: var(--muted); }
.tag-full { background: rgba(255,92,92,.15); color: var(--red); }
.tag-creator { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 5px; background: rgba(232,182,76,.15); color: var(--gold); margin-left: 6px; font-weight: 600; }

/* ---- 成员 ---- */
.member-list { display: flex; flex-direction: column; gap: 8px; }
.member-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
}
.member-item.me { border-color: var(--gold); }
.member-name { font-size: 15px; font-weight: 600; }
.member-bal { font-size: 16px; font-weight: 800; }
.member-bal .pos { color: var(--red); }
.member-bal .neg { color: var(--green); }
.member-bal .even { color: var(--muted); }

/* ---- 房间号 ---- */
.room-code-card { text-align: center; padding: 20px 16px; }
.room-code-big { font-size: 34px; font-weight: 900; letter-spacing: 8px; color: var(--gold); margin-bottom: 4px; }
.room-code-hint { color: var(--muted); font-size: 12px; }

/* ---- 操作区 ---- */
.action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.action-row .btn-primary, .action-row .btn-ghost, .action-row .btn-danger { flex: 1; min-width: 90px; }
.notice { color: var(--muted); font-size: 13px; text-align: center; padding: 8px; }

/* ---- 台费账户 ---- */
.fee-card { text-align: center; background: linear-gradient(160deg, #2b3a24, #243148); border-color: rgba(62,207,142,.3); }
.fee-label { color: var(--muted); font-size: 13px; }
.fee-amount { font-size: 34px; font-weight: 900; color: var(--green); margin: 4px 0; }
.fee-hint { color: var(--muted); font-size: 12px; }

/* ---- 汇总表 ---- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { color: var(--muted); font-weight: 600; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 12px; }
.tbl td { padding: 9px 6px; border-bottom: 1px solid rgba(53,69,106,.5); }
.tbl .pos { color: var(--red); font-weight: 700; }
.tbl .neg { color: var(--green); font-weight: 700; }
.tbl .even { color: var(--muted); }
/* 成员明细行：每个人下面显示"给谁多少"（横向一排三格） */
.tbl .tbl-detail td { padding: 4px 6px 6px 30px; border-bottom: none; color: var(--muted); font-size: 12px; }
.tbl .td-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 8px; text-align: center; }
.tbl .td-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl .td-cell b { color: var(--text); font-weight: 600; }
.tbl tr.tbl-main td { padding: 10px 6px 4px; }
.tbl tr.tbl-main:first-of-type td { padding-top: 9px; }
.fee-line { margin-top: 10px; color: var(--muted); font-size: 13px; }
.fee-line b { color: var(--green); font-size: 15px; }

/* ---- 流水 ---- */
.txn-list { display: flex; flex-direction: column; }
.txn-item {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 2px; border-bottom: 1px solid rgba(53,69,106,.5);
}
.txn-item:last-child { border-bottom: none; }
.txn-item.revoked { opacity: .45; }
.txn-main { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.txn-type { font-size: 11px; padding: 2px 7px; border-radius: 5px; font-weight: 700; }
.txn-type.trans { background: rgba(77,159,255,.15); color: var(--blue); }
.txn-type.fee { background: rgba(62,207,142,.15); color: var(--green); }
.txn-desc { font-size: 14px; }
.txn-sub { width: 100%; color: var(--muted); font-size: 11px; padding-left: 42px; }
.txn-amt { font-weight: 800; color: var(--red); margin-left: auto; }

/* ---- 弹层 ---- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10,14,22,.7);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 640px;
  background: var(--card);
  border: 1px solid var(--line); border-top-left-radius: 16px; border-top-right-radius: 16px;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.sheet select, .sheet input {
  width: 100%; padding: 12px 14px; font-size: 16px;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; outline: none; margin-bottom: 12px;
}
.sheet select:focus, .sheet input:focus { border-color: var(--gold); }

/* ---- 其它 ---- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.85); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 100;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loading, .empty { color: var(--muted); font-size: 13px; text-align: center; padding: 14px 0; }
.diag { padding: 10px 16px 4px; font-size: 12px; color: var(--muted); text-align: center; word-break: break-all; }
/* 自定义数字键盘 */
.num-panel { margin-bottom: 12px; }
.num-show { font-size: 40px; font-weight: 900; text-align: center; color: var(--gold); background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; min-height: 58px; line-height: 1; }
.num-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.num-key { background: #222e45; border: 1px solid var(--line); color: var(--text); border-radius: 10px; font-size: 24px; font-weight: 700; padding: 12px 0; cursor: pointer; }
.num-key:active { background: #2d3c58; }
.num-key-fn { font-size: 15px; color: var(--muted); }
