/* Poker Faces —— 手机优先，暗色牌桌配色 */
:root {
  --bg: #0b1410;
  --panel: #14261d;
  --panel2: #1b3327;
  --line: #2a4636;
  --text: #e8f0ea;
  --muted: #8aa899;
  --accent: #35c07a;
  --accent2: #e0b64a;
  --danger: #e0604f;
  --radius: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  overscroll-behavior-y: none;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--danger); min-height: 20px; font-size: 13px; margin: 8px 0 0; }
a { color: var(--accent); }

/* ---------- 登录 ---------- */
.auth {
  display: flex; align-items: center; justify-content: center;
  min-height: 100%; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 24px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 26px; }
.auth-card form { margin-top: 18px; }
label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%; margin-top: 6px; padding: 11px 12px; font-size: 16px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
button {
  font: inherit; padding: 11px 14px; border-radius: 10px; cursor: pointer;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
}
button.primary { background: var(--accent); color: #05210f; border: 0; font-weight: 700; width: 100%; }
button.ghost { background: transparent; border: 0; color: var(--muted); }
button.danger { color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .5; }

/* ---------- 布局 ---------- */
#shell { display: flex; flex-direction: column; height: 100%; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  padding-top: max(10px, env(safe-area-inset-top));
}
.brand { font-weight: 700; }
#view { flex: 1; overflow-y: auto; padding: 14px 14px 90px; -webkit-overflow-scrolling: touch; }
.tabs {
  display: flex; background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
}
.tabs button {
  flex: 1; border: 0; background: transparent; border-radius: 0;
  padding: 10px 0 12px; font-size: 12px; color: var(--muted);
}
.tabs button.active { color: var(--accent); font-weight: 700; }

/* ---------- 卡片 / 区块 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.card h2 { margin: 0 0 10px; font-size: 16px; }
.card h3 { margin: 16px 0 8px; font-size: 14px; color: var(--muted); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.spacer { height: 8px; }
.center { text-align: center; }

/* ---------- 牌 ---------- */
.cardrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pcard {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 44px; padding: 0 6px;
  background: #f4f6f4; color: #111; border-radius: 6px;
  font-weight: 700; font-size: 16px; letter-spacing: .5px;
}
.pcard.red { color: #c0271b; }
.pcard.back { background: repeating-linear-gradient(45deg, #2b4a6f, #2b4a6f 4px, #1d3550 4px, #1d3550 8px); color: transparent; }
.pcard.sm { min-width: 26px; height: 34px; font-size: 13px; }
.boardrow { margin: 6px 0; }

/* ---------- 手牌列表 ---------- */
.hand-item {
  display: flex; gap: 10px; align-items: center;
  padding: 11px 12px; border-bottom: 1px solid var(--line);
}
.hand-item:last-child { border-bottom: 0; }
.hand-item .grow { flex: 1; min-width: 0; }
.hand-item .net { font-weight: 700; white-space: nowrap; }
.net.pos { color: var(--accent); }
.net.neg { color: var(--danger); }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 20px; font-size: 11px;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line);
  margin-right: 5px;
}
.badge.pub { color: var(--accent); border-color: var(--accent); }
.badge.shr { color: var(--accent2); border-color: var(--accent2); }
.badge.key { color: var(--danger); border-color: var(--danger); }

/* ---------- 统计 ---------- */
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--panel2); border-radius: 10px; padding: 9px 10px; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 18px; font-weight: 700; }
.stat .n { font-size: 10px; color: var(--muted); }
.bar { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.leak { padding: 8px 10px; border-left: 3px solid var(--accent2); background: var(--panel2);
        border-radius: 6px; margin-bottom: 8px; font-size: 14px; }

/* ---------- 全屏层 ---------- */
.sheet {
  position: fixed; inset: 0; background: var(--bg); z-index: 20;
  display: flex; flex-direction: column;
}
.sheet-bar {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding-top: max(10px, env(safe-area-inset-top));
}
#sheet-body { flex: 1; overflow-y: auto; padding: 14px 14px 40px; }

/* ---------- 回放 ---------- */
.replay-step { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.replay-step .who { font-weight: 700; }
.replay-step.hero .who { color: var(--accent); }
.eqbar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: #000c; color: #fff; padding: 10px 16px; border-radius: 20px;
  font-size: 14px; z-index: 40; max-width: 90vw; text-align: center;
  white-space: pre-line; line-height: 1.45;
}
.chip {
  display: inline-block; padding: 7px 12px; margin: 0 6px 6px 0;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 20px; font-size: 13px; cursor: pointer;
}
.chip.on { background: var(--accent); color: #05210f; border-color: var(--accent); font-weight: 700; }
.action-row { display: grid; grid-template-columns: 1.2fr 1fr .8fr auto; gap: 6px; margin-bottom: 6px; }
.action-row input, .action-row select { margin-top: 0; padding: 8px; font-size: 14px; }
.action-row button { padding: 8px 10px; }
details summary { cursor: pointer; padding: 8px 0; color: var(--muted); }
pre.md { white-space: pre-wrap; word-wrap: break-word; font-family: inherit; margin: 0; }
h2.md-h { font-size: 15px; color: var(--accent); margin: 16px 0 6px; }

/* 对手翻前状态行 */
.vflag { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.vflag .vname { min-width: 60px; font-size: 14px; }
.vflag .seg { display: flex; gap: 4px; }
.vflag .chip { padding: 5px 10px; margin: 0; font-size: 12px; }
.vflag .vhole {
  width: 88px; margin: 0; padding: 6px 8px; font-size: 13px; text-transform: none;
}
.chip.dim { opacity: .38; }
.banner {
  padding: 9px 11px; border-radius: 8px; margin-bottom: 10px; font-size: 13px;
  background: var(--panel2); border-left: 3px solid var(--accent2);
}

/* ---------- 点选器 ---------- */
.picker {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--panel); border-top: 1px solid var(--accent);
  border-radius: 16px 16px 0 0; padding: 10px 10px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px #0009;
}
.picker-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: 13px; color: var(--muted);
}
.picker-preview { flex: 1; display: flex; gap: 6px; justify-content: center; }
.picker-head button { padding: 6px 10px; font-size: 13px; }
.picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.picker-grid button {
  padding: 0; height: 46px; font-size: 17px; font-weight: 700;
}
.picker-grid button.on { background: var(--accent); color: #05210f; border-color: var(--accent); }
.picker-suits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.picker-suits button { height: 52px; font-size: 22px; }
.picker-suits button.red { color: #e0604f; }
.pickbtn { flex: 0 0 auto; padding: 11px 12px; font-size: 16px; }

/* ---------- 照片 ---------- */
.photo-preview { text-align: center; margin: 6px 0 12px; }
.photo-preview img {
  width: 108px; height: 108px; object-fit: cover;
  border-radius: 50%; border: 2px solid var(--accent);
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line); flex: 0 0 auto; background: var(--panel2);
}
.avatar.lg { width: 72px; height: 72px; }
.match-row { display: flex; align-items: center; gap: 10px; padding: 10px 0;
             border-bottom: 1px solid var(--line); }

/* 邀请码列表：每行是"状态 + 码 + 谁发的/谁用的"，
   比一行密密麻麻的文字好扫——管理员经常要对着找人。 */
.invite-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.invite-row:last-child { border-bottom: none; }
.invite-row code { font-size: 12px; }

/* ---------- 拍照层 ----------
   黑底全屏，视频铺满。手机上要能单手按到"拍摄"，所以按钮条固定在底部。 */
.camera {
  position: fixed; inset: 0; z-index: 60; background: #000;
  display: flex; flex-direction: column;
}
.camera video, .camera img {
  flex: 1 1 auto; width: 100%; min-height: 0;
  object-fit: contain; background: #000;
}
/* 前置摄像头镜像显示，自拍时看着自然；拍到的像素不镜像 */
.camera video { transform-origin: center; }
.camera-hint {
  margin: 0; padding: 8px 16px; color: #ddd; font-size: 13px; text-align: center;
  background: rgba(0, 0, 0, .55);
}
.camera-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .75);
}
.camera-bar .shoot {
  width: 68px; height: 68px; border-radius: 50%; font-size: 26px; line-height: 1;
  background: #fff; color: #d33; border: 4px solid rgba(255, 255, 255, .45);
  flex: 0 0 auto;
}
.camera-bar .primary, .camera-bar .ghost { flex: 0 1 auto; }
.camera-bar button[hidden], .camera-bar .hidden { display: none; }
.match-row:last-child { border-bottom: 0; }
.match-row .arrow { color: var(--accent2); font-size: 18px; }
.match-row .who { flex: 1; min-width: 0; font-size: 13px; }
.match-row .who b { display: block; font-size: 14px; }
.score { font-size: 12px; color: var(--muted); }
.score.high { color: var(--accent2); font-weight: 700; }
input[type=file] { padding: 8px; font-size: 14px; }

/* 标签上的待办角标：管理员有疑似重复账户要复核 */
.alert-dot {
  display: inline-block; min-width: 16px; height: 16px; line-height: 16px;
  padding: 0 4px; margin-left: 4px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  vertical-align: top;
}
