/* 雀迹 · 移动端优先样式
 * ---------------------------------------------------------------------------
 * v0.20.0 视觉重构：以「现代日式雀庄」为基调 ——
 *   · 深松绿主色 + 黄铜金点缀 + 暖米白纸感底色，替代原来的冷灰绿；
 *   · 统一 4/8 间距节奏、18px 卡片圆角、三级柔和投影；
 *   · 底栏改为悬浮胶囊，顶栏加品牌渐变与金色收边；
 *   · 所有既有的 id / class / 文案保持不动，仅重做外观，避免影响业务与测试契约。
 * 设计依据：ui-ux-pro-max（Minimalism & Swiss Style + 暖色 hospitality 调性），
 * 触控目标 ≥44px、正文对比度 ≥4.5:1、支持 reduced-motion。
 * ------------------------------------------------------------------------- */
:root {
  /* 店内灯光偏亮，界面固定浅色，避免手机系统深色模式把原生控件染成深色 */
  color-scheme: light;
  /* 色板 */
  --bg: #f5f2ea;
  --bg-2: #efece1;
  --bg2: var(--bg-2);          /* 兼容管理端内联样式里的旧变量名 */
  --card: #ffffff;
  --ink: #1b2a24;
  --ink2: #5f7069;
  --ink3: #5f6e68;          /* 原 #8b9a93 对比度仅 ≈2.6:1，加深到 ≈4.9:1 */
  --line: #e5e1d6;
  --line-2: #efebe1;

  --brand: #14654e;
  --brand-2: #0d4a38;
  --brand-3: #2b8a6b;
  --brand-weak: #e6f1ec;
  --brand-mist: #f2f8f4;

  --gold: #a67c2e;
  --gold-ink: #7d5c1f;
  --gold-2: #c9a45c;
  --gold-weak: #faf3e2;

  --warn: #a85a12;
  --warn-weak: #fdf1e2;
  --danger: #b3261e;
  --danger-weak: #fbeae8;
  --ok: #1f7a57;

  /* 形状与阴影 */
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(20, 45, 34, .04), 0 2px 8px rgba(20, 45, 34, .05);
  --shadow-md: 0 10px 30px rgba(20, 45, 34, .09);
  --shadow-lg: 0 18px 48px rgba(15, 40, 32, .2);

  /* 节奏 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --topbar-h: 56px;
  --tabbar-h: 66px;

  /* 动效 */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur-fast: 140ms;
  --dur: 200ms;
  --font-sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
#topbar :focus-visible { outline-color: #fff; }
::selection { background: rgba(20, 101, 78, .16); }

/* ---- 顶栏 ---- */
#topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 4px;
  min-height: var(--topbar-h);
  background:
    radial-gradient(120% 120% at 92% -30%, rgba(255, 255, 255, .14), transparent 58%),
    linear-gradient(160deg, #17634d 0%, #0e4a38 58%, #0a3b2c 100%);
  color: #fff;
  padding: calc(6px + env(safe-area-inset-top)) 6px 6px;
  box-shadow: 0 2px 14px rgba(9, 38, 29, .18);
}
/* 顶栏底部金色收边：一处很细的品牌记忆点 */
#topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 164, 92, .55), transparent);
  pointer-events: none;
}
#pageTitle {
  flex: 1; min-width: 0;
  font-size: 16.5px; font-weight: 600; letter-spacing: .4px;
  padding-left: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#topbar .icon-btn, #topbar #homeLink {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: none; border: none; color: #fff; font-size: 20px;
  text-decoration: none; border-radius: 12px; cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
#topbar .icon-btn:active, #topbar #homeLink:active { background: rgba(255, 255, 255, .14); }
#topbar .icon-btn svg, #topbar #homeLink svg { width: 21px; height: 21px; display: block; }
#topbar .icon-btn[hidden] { display: none; }
#topbar #homeLink { font-size: 18px; }

/* ---- 底栏：悬浮胶囊 ---- */
#tabbar {
  position: fixed; left: 10px; right: 10px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex; gap: 2px;
  padding: 6px;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(229, 225, 214, .92);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
}
#tabbar a {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: 48px;                       /* 触控目标 ≥44px */
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink2); font-size: 10.5px; line-height: 1.2;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
#tabbar a .t-ico {
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; line-height: 1; height: 24px;
}
#tabbar a .t-ico svg { width: 22px; height: 22px; display: block; }
#tabbar a .t-label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#tabbar a.active { color: var(--brand); font-weight: 600; background: var(--brand-weak); }
#tabbar a:active { background: var(--brand-mist); }

/* ---- 其他麻将入口：顶栏九宫格按钮 + 浮层 ---- */
#portalBtn { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
#portalMask {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(12, 30, 24, .36);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
/* display:flex 会盖过 [hidden] 的 display:none，必须显式收起来，否则面板一直挡点击 */
#portalMask[hidden], #portalPanel[hidden] { display: none; }
#portalPanel {
  position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 6px);
  right: max(10px, env(safe-area-inset-right)); z-index: 45;
  width: min(86vw, 330px);
  max-height: calc(100vh - var(--topbar-h) - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pp-pop var(--dur) var(--ease);
}
@keyframes pp-pop {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
#portalPanel .pp-head {
  padding: 12px 16px; font-size: 14px; font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--brand-mist), #fff);
}
#portalPanel .pp-list {
  flex: 1; min-height: 0;
  padding: 6px; max-height: 60vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#portalPanel .pp-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  min-height: 48px;                                  /* 手机触控目标 ≥ 44px */
  border: none; background: none; cursor: pointer; text-align: left;
  padding: 8px; border-radius: 13px;
  transition: background var(--dur-fast) var(--ease);
}
#portalPanel .pp-item:active { background: var(--brand-weak); }
#portalPanel .pp-ico {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  background: var(--brand-mist);
  border: 1px solid var(--line-2);
}
#portalPanel .pp-txt { flex: 1; min-width: 0; }
#portalPanel .pp-name {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; color: var(--ink); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 外链小徽章 */
#portalPanel .pp-extbadge {
  flex: none; font-size: 10px; font-weight: 500; line-height: 1;
  color: var(--ink2); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 5px;
}
#portalPanel .pp-state { flex: none; display: flex; align-items: center; }
#portalPanel .pp-arrow { color: var(--ink3); font-size: 20px; line-height: 1; }
#portalPanel .pp-cur { color: var(--brand); font-size: 17px; font-weight: 700; line-height: 1; }
/* 当前所在系统：整行浅绿底 + 名称品牌色，点击不跳转时也给出默认光标 */
#portalPanel .pp-item.is-current { background: var(--brand-weak); cursor: default; }
#portalPanel .pp-item.is-current .pp-name { color: var(--brand); }
#portalPanel .pp-foot { padding: 10px 16px 12px; font-size: 12px; color: var(--ink3); border-top: 1px solid var(--line); }

/* ---- 扫码进桌：顶栏扫码按钮 + 取景/拍照浮层 ---- */
#scanBtn { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
#scanMask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 16, 14, .72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
#scanMask[hidden], #scanPanel[hidden] { display: none; }
#scanPanel {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 55;
  width: min(90vw, 350px);
  background: var(--card); border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 16px; text-align: center;
  animation: sc-pop var(--dur) var(--ease);
}
@keyframes sc-pop {
  from { opacity: 0; transform: translate(-50%, -47%) scale(.97); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
#scanPanel .sc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
#scanPanel .sc-head b { font-size: 16px; }
#scanPanel .sc-close {
  background: var(--bg); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  font-size: 17px; line-height: 1; color: var(--ink2);
}
#scanPanel .sc-stage {
  position: relative; margin-bottom: 12px;
  border-radius: 16px; overflow: hidden; background: #0b1512;
  aspect-ratio: 1 / 1;
}
#scanPanel .sc-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 取景框：中间留一块亮区、四周压暗，提示"把码放进框里" */
#scanPanel .sc-frame {
  position: absolute; inset: 12%;
  border: 2px solid rgba(255, 255, 255, .9); border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .24), inset 0 0 24px rgba(201, 164, 92, .28);
}
#scanPanel .sc-hint { margin: 0 2px 12px; min-height: 34px; font-size: 12.5px; line-height: 1.55; color: var(--ink2); }
#scanPanel .sc-shoot { display: block; width: 100%; }
#scanPanel.sc-live .sc-shoot { background: var(--brand-weak); color: var(--brand); box-shadow: none; border: 1px solid rgba(20, 101, 78, .14); }
@media (max-width: 520px) {
  #scanPanel {
    left: 0; right: 0; top: auto; bottom: 0; transform: none;
    width: 100%; border-radius: 24px 24px 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    animation: sc-sheet var(--dur) var(--ease);
  }
  @keyframes sc-sheet {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* 壳内入口占位页 */
.portal-page { text-align: center; padding: 34px 18px; }
.portal-hero { margin-bottom: 14px; }
.portal-hero-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 78px; height: 78px; border-radius: 24px; font-size: 40px;
  background: var(--brand-weak);
  border: 1px solid rgba(20, 101, 78, .08);
  box-shadow: var(--shadow-sm);
}
.portal-page h3 { font-size: 18px; margin: 0 0 8px; }
.portal-page .btn { margin-top: 14px; }

/* 壳内 iframe 页：雀迹顶栏保留（返回靠它），底栏隐藏（外站可能自带导航），外站铺满到屏幕底 */
body.qj-frame #tabbar { display: none !important; }
.frame-shell {
  position: fixed;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  bottom: 0;
  left: 0; right: 0;
  display: flex; flex-direction: column;
  background: var(--card);
}
.frame-bar {
  flex: none; min-height: 38px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 4px 12px;
  font-size: 12px; color: var(--ink2);
  background: var(--brand-mist); border-bottom: 1px solid var(--line);
}
.frame-bar-name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame-bar-ext { flex: none; color: var(--brand); text-decoration: none; white-space: nowrap; font-weight: 600; }
.frame-iframe { flex: 1; min-height: 0; width: 100%; border: 0; background: #fff; }
.frame-loading {
  position: absolute; left: 0; right: 0; top: 38px; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--ink2); background: #fff;
}
.frame-loading.hide { display: none; }

/* ---- 通用布局 ---- */
#app { padding: 16px 14px 8px; max-width: 600px; margin: 0 auto; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-4);
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.card h3 {
  margin: 0 0 10px;
  font-size: 15.5px; font-weight: 700; letter-spacing: .2px;
  color: var(--ink);
}
.card h3 .badge { margin-left: 4px; }
.card > h3:last-child { margin-bottom: 0; }

/* 首页公告栏（管理端「公告」tab 编辑） */
.notice-card {
  position: relative;
  border-color: rgba(166, 124, 46, .28);
  background: linear-gradient(180deg, #fffdf7 0%, #fff 70%);
  box-shadow: 0 4px 18px rgba(166, 124, 46, .08);
  padding-left: 18px;
  overflow: hidden;
}
.notice-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
}
.notice-card h3 { color: var(--gold-ink); }
.notice-body {
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;      /* 保留店员输入的换行 */
  word-break: break-word;
}
.notice-meta { margin-top: 10px; font-size: 12px; color: var(--ink3); text-align: right; }

.hint { color: var(--ink2); font-size: 12.5px; line-height: 1.65; margin: 6px 0; }
.hint b { color: var(--ink); }
p.hint:last-child { margin-bottom: 0; }

/* ---- 按钮 ---- */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 48px;
  border: none; border-radius: 14px;
  background: linear-gradient(135deg, #1b7356 0%, #0f4f3c 100%);
  color: #fff; font-size: 16px; font-weight: 600; letter-spacing: .3px;
  padding: 12px 16px; margin-top: 10px;
  cursor: pointer;
  text-align: center; text-decoration: none;
  box-shadow: 0 6px 16px rgba(16, 80, 58, .22);
  touch-action: manipulation;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.btn:active {
  transform: translateY(1px) scale(.995);
  box-shadow: 0 3px 10px rgba(16, 80, 58, .2);
}
.btn.ghost {
  background: var(--brand-weak); color: var(--brand);
  border: 1px solid rgba(20, 101, 78, .12);
  box-shadow: none;
}
.btn.warn { background: linear-gradient(135deg, #b8721f, #8f5410); box-shadow: 0 6px 16px rgba(168, 90, 18, .22); }
.btn.danger { background: linear-gradient(135deg, #c0352c, #95211a); box-shadow: 0 6px 16px rgba(179, 38, 30, .22); }
.btn.small { width: auto; display: inline-flex; min-height: 44px; padding: 7px 14px; font-size: 13.5px; margin: 0; border-radius: 10px; box-shadow: none; }
.btn[disabled] { opacity: .42; pointer-events: none; box-shadow: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 0; }

/* ---- 表单 ---- */
input, select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 16px;              /* 16px 防止 iOS 聚焦自动缩放 */
  background: #fbf9f4;
  color: var(--ink);
  outline: none; font-family: inherit;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
textarea { resize: vertical; line-height: 1.65; font-size: 15px; min-height: 96px; }
input:focus, select:focus, textarea:focus {
  background: #fff; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 101, 78, .12);
}
input::placeholder, textarea::placeholder { color: var(--ink3); }
/* 复选框会被上面的通用 input 样式（width:100% + 大内边距）拉成整行大方框，单独还原成正常勾选框 */
input[type="checkbox"] {
  width: 22px; height: 22px; min-height: 0; flex: none;
  padding: 0; margin: 0 8px 0 0;
  accent-color: var(--brand);
  vertical-align: -6px;
  background: none; border: none; box-shadow: none;
}
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
label.fld { display: block; margin-bottom: 10px; font-size: 13px; color: var(--ink2); font-weight: 500; }
label.fld input, label.fld select, label.fld textarea { margin-top: 6px; }

/* ---- 徽章 ---- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
}
.badge.g { background: var(--brand-weak); color: var(--brand); }
.badge.y { background: var(--warn-weak); color: var(--warn); }
.badge.r { background: var(--danger-weak); color: var(--danger); }
.badge.gray { background: #eef0ec; color: var(--ink2); }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 26px);
  transform: translateX(-50%);
  background: rgba(16, 38, 30, .94);
  color: #fff; font-size: 14px; line-height: 1.5;
  padding: 11px 18px; border-radius: 999px; z-index: 99; max-width: 86vw;
  text-align: center;
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: toast-in var(--dur) var(--ease);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---- 麻将牌（真实麻将图案，本地 SVG 素材） ---- */
.tiles { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 8px 0; max-width: 320px; }
.tile {
  position: relative; aspect-ratio: 40 / 56; border-radius: 5px;
  /* 素材自带牌体、边框与立体光影，此处不再叠加背景/描边，避免双重边框 */
  display: flex; align-items: center; justify-content: center;
  user-select: none; overflow: hidden;
}
.tile .face {
  display: block; width: 100%; height: 100%;
  object-fit: contain; pointer-events: none;   /* <img>：矢量素材任意尺寸都清晰 */
}
/* 赤5：素材已是红5图案，仅加一圈红色提示边，避免与普通5混淆 */
.tile.aka { box-shadow: 0 0 0 1.5px #e0847c, 0 1px 3px rgba(0,0,0,.14); border-radius: 6px; }
.tile.win-tile { box-shadow: 0 0 0 2px #e5c96a, 0 1px 4px rgba(190,150,20,.28); border-radius: 6px; }
.tile.sm { width: 32px; height: 45px; flex: 0 0 auto; }
/* 副露行里的小牌（吃/碰/杠草稿与已亮副露）：必须带 .tile，牌面图才会被约束尺寸 */
.tile.meld-tile { width: 26px; height: 36px; flex: 0 0 auto; }
.tile.dim { opacity: .26; pointer-events: none; }
.aka-cap {
  position: absolute; right: 1px; bottom: 0; font-style: normal;
  font-size: 9px; font-weight: 700; color: #d0342c; background: rgba(255,255,255,.86);
  border-radius: 3px; padding: 0 2px; line-height: 1.25;
}

.pickpad { margin-top: 0; }
.pickpad .suit-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.pickpad .suit-tabs button {
  flex: 1; min-height: 40px;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 8px 0; font-size: 14px; color: var(--ink2); cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.pickpad .suit-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.tile-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 290px; }
.tile-grid.honor { grid-template-columns: repeat(4, 1fr); }
.tile-grid .tile { cursor: pointer; }
.tile-grid .tile:active { transform: translateY(1px); }

/* ---- 桌位网格 ---- */
.table-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.table-card {
  position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 14px 15px; text-align: center; text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
/* 牌桌状态点：可用=绿点，占用=金点，停用=灰点 */
.table-card::before {
  content: ''; position: absolute; top: 12px; right: 12px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand-3);
  box-shadow: 0 0 0 3px rgba(43, 138, 107, .12);
}
.table-card .t-name { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.table-card .t-state { margin-top: 6px; font-size: 12px; color: var(--ink2); }
/* 单价：顾客在首页就能看到本桌每人每局多少钱（0 = 不收费） */
.table-card .t-price {
  display: inline-block; margin-top: 8px;
  font-size: 12px; font-weight: 600; color: var(--brand);
  background: var(--brand-weak); border-radius: 999px; padding: 2px 9px;
}
.table-card.busy { border-color: rgba(201, 162, 39, .5); background: linear-gradient(180deg, #fffcf1, #fff); }
.table-card.busy::before { background: #c9a227; box-shadow: 0 0 0 3px rgba(201, 162, 39, .14); }
.table-card.off { opacity: .5; }
.table-card.off::before { background: var(--ink3); box-shadow: 0 0 0 3px rgba(139, 154, 147, .14); }

/* ---- 管理端：桌位管理里每张桌一块（改名 / 停用 / 单价 / 重置二维码） ---- */
.tbl-block {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 12px 6px; margin-bottom: 10px;
  background: #fdfcf8;
}
.tbl-block .fld { flex: 1 1 auto; }
.tbl-block .fld input { width: 100%; }
.tbl-block .t-name { font-size: 15px; font-weight: 600; line-height: 1.35; }
.tbl-block .t-id {
  font-size: 12px; font-weight: 500; color: var(--ink2);
  background: var(--line-2); border-radius: 6px; padding: 1px 6px; margin-left: 4px;
}

/* ---- 管理端：充值赠送活动的档位展示与逐行编辑 ---- */
.promo-tiers { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 3px; }
.promo-tier {
  font-size: 12.5px; line-height: 1.4; color: var(--ink2);
  background: var(--brand-weak); border-radius: 8px; padding: 3px 8px;
}
.promo-tier b { color: var(--brand); font-weight: 600; }
.tier-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 6px 0 6px; font-size: 13px; font-weight: 600;
}
.tier-head .hint { margin: 0; font-weight: 400; }
.tier-row {
  display: grid; grid-template-columns: 1fr 1fr auto;
  gap: 6px; align-items: end; margin-bottom: 8px;
}
.tier-row .fld { margin: 0; }
.tier-row .tier-cap { display: block; font-size: 12px; color: var(--ink2); }
.tier-row .btn.small { margin: 0; align-self: end; min-height: 48px; }
#pf-tiers { margin-bottom: 8px; }

/* ---- 管理端：账单表（历史结算单） ---- */
.bill-table {
  width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 10px;
}
.bill-table th, .bill-table td {
  padding: 8px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.bill-table th { color: var(--ink2); font-weight: 600; text-align: left; font-size: 12px; }

/* ---- 本机身份条 ---- */
/* 身份条：v0.5.0 起是「登录态」而非本机昵称 —— 已登录时一行文字 + 一行按钮，
   未登录时一句说明 + 登录入口，都按块级排布（400px 屏上按钮横排会挤） */
.me-bar { padding: 12px 14px; }
.me-bar .me-who { font-size: 14px; }
.me-bar .me-who b { color: var(--brand); }
.me-bar .row { margin-top: 8px; }
.me-bar .btn { margin-top: 0; }
.me-bar .me-tip { font-size: 12.5px; color: var(--ink2); line-height: 1.5; }

/* ---- 四家座位（東南西北） ---- */
.seat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0; }
.seat {
  border: 1px dashed var(--line); border-radius: 12px; padding: 10px 4px;
  text-align: center; background: #fbfaf5; min-width: 0;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.seat .sw { display: block; font-size: 16px; font-weight: 800; color: var(--ink3); letter-spacing: 1px; }
.seat .sn {
  display: block; font-size: 12px; margin-top: 3px; color: var(--ink2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seat.taken { border-style: solid; border-color: rgba(20, 101, 78, .45); background: var(--brand-weak); }
.seat.taken .sw { color: var(--brand); }
.seat.taken .sn { color: var(--ink); font-weight: 600; }
.seat.mine { border-color: var(--gold); background: var(--gold-weak); box-shadow: 0 0 0 2px rgba(166, 124, 46, .12); }
.seat.mine .sw { color: var(--gold-ink); }
.seat-grid.sm .seat { padding: 6px 2px; }
.seat-grid.sm .seat .sw { font-size: 13px; }
.seat-grid.sm .seat .sn { font-size: 12px; }
.seat-tag {
  flex: 0 0 auto; width: 26px; text-align: center; font-weight: 800; color: var(--brand);
  background: var(--brand-weak); border-radius: 8px; padding: 6px 0; font-size: 14px;
}
/* ---- 开局前确认东起（亲家）：四人两列点选，选中高亮 ---- */
.east-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0 6px; }
.east-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px;
  background: #fbfaf5; color: var(--ink); font-size: 14px; text-align: left; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.east-opt .eo-name {
  font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.east-opt small { font-size: 12px; color: var(--ink2); }
.east-opt.on { border-color: var(--brand); background: var(--brand-weak); box-shadow: inset 0 0 0 1px var(--brand); }
.east-opt.on small { color: var(--brand); font-weight: 700; }
.east-opt[disabled] { opacity: .45; cursor: default; }
.rp .seat-mark { font-weight: 800; color: var(--ink2); margin-right: 2px; }
.live-card h3 .badge { margin-left: 4px; }
.live-card.idle { opacity: .8; }

/* ---- 管理端：每桌 4 个座位二维码 ---- */
.qr4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; justify-items: center; }
.qr-cell { text-align: center; }
.qr-cell .qr-seat { font-size: 13px; font-weight: 700; color: var(--brand); margin-top: 4px; }
.qr-cell canvas, .qr-cell img { border: 1px solid var(--line); border-radius: 10px; }
.qr-table { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fdfcf8; }
.qr-table .tn { flex: 1; min-width: 0; font-weight: 600; }
.qr-table .qrs { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- 结果展示 ---- */
.waits { display: flex; flex-direction: column; gap: 6px; }
.wait-item {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--brand-mist); border: 1px solid rgba(20, 101, 78, .08);
  border-radius: 12px; padding: 6px 9px;   /* 元信息字号提到 12px 后，收紧内边距保住手机高度 */
}
.wait-item .tile { width: 34px; height: 48px; flex: 0 0 auto; }
.w-main { flex: 1; min-width: 0; }
.w-head { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.w-head .rem { font-size: 12px; color: var(--ink2); }
.w-pay { font-size: 12.5px; color: var(--ink); line-height: 1.5; }
.w-pay b { color: var(--brand); font-weight: 700; }
.w-pay .fu { color: var(--ink2); font-size: 12px; margin-left: 3px; }
.noyaku { color: var(--warn); font-weight: 600; }
.wait-item .yaku-tags { margin-top: 2px; gap: 3px; }
.wait-item .yaku-tag { font-size: 12px; padding: 0 6px; }
.card h3 .tile.sm { vertical-align: middle; margin-left: 4px; }
.pay { font-size: 13px; color: var(--ink); line-height: 1.45; }
.pay b { color: var(--brand); }

/* 条件设置：默认折叠，避免占满手机首屏 */
.opt-card { padding: 0; }
.opt-card > summary {
  padding: 13px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  list-style: none; display: flex; align-items: center; gap: 8px;
}
.opt-card > summary::-webkit-details-marker { display: none; }
.opt-card > summary::after { content: '▾'; margin-left: auto; color: var(--ink3); font-size: 12px; }
.opt-card[open] > summary::after { content: '▴'; }
.opt-sum { font-weight: 400; font-size: 12.5px; color: var(--ink2); }
.opt-card > .row { padding: 0 16px; }
.opt-card[open] { padding-bottom: 8px; }
.yaku-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.yaku-tag { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 1px 7px; font-size: 12px; color: var(--ink); }
.yaku-tag.aka { background: var(--danger-weak); border-color: #f0b7b2; color: var(--danger); font-weight: 600; }
.big-num { font-size: 22px; font-weight: 800; color: var(--brand); }

/* ---- 战绩表 ---- */
.rec { border-top: 1px solid var(--line-2); padding: 12px 2px; }
.rec:first-of-type { border-top: none; }
/* 已完成 / 已作废要一眼分开：徽章换色之外，左边再加一道色条（列表长时扫起来更快）。
   状态类由 app.js 的 admSummary 打在 .rec 上（s-finished / s-void / s-pending_confirm …）。 */
.rec.s-finished { border-left: 3px solid #b7dccd; padding-left: 10px; }
.rec.s-void { border-left: 3px solid #efc4c0; padding-left: 10px; }
.rec.s-void .rec-id, .rec.s-void .rank-row { opacity: .7; }
.rec.s-void .rec-id { text-decoration: line-through; }
.rec.s-pending_confirm, .rec.s-ongoing { border-left: 3px solid #f0d7b0; padding-left: 10px; }
.rec .rec-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink2); margin-bottom: 6px; }
.rec .rec-id { font-weight: 700; color: var(--ink); }
.rank-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rp {
  border-radius: 8px; padding: 4px 8px; font-size: 12.5px; background: #f2f2ec;
  display: flex; gap: 6px; align-items: baseline;
}
.rp .r { font-weight: 800; }
.rp.p1 .r { color: #a67c2e; } .rp.p1 { background: var(--gold-weak); }
.rp.p2 .r { color: #5f6b76; } .rp.p2 { background: #f1f3f5; }
.rp.p3 .r { color: #8a5a2b; } .rp.p3 { background: #f7f1ea; }
/* 等待大厅排队名单：按入队顺序编号，自己高亮 */
.wait-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wait-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  border: 1px solid var(--line); border-radius: 99px;
  padding: 5px 12px; font-size: 13px; background: #fff;
}
.wait-chip b { color: var(--ink2); font-weight: 800; }
.wait-chip small { color: var(--ink3); font-size: 12px; }
.wait-chip.mine { background: var(--brand-weak); border-color: var(--brand); color: var(--brand); font-weight: 700; }
.wait-chip.mine b { color: var(--brand); }
.stat-row { display: flex; gap: 10px; margin-bottom: 12px; }
.stat-row .card { flex: 1; text-align: center; margin: 0; padding: 14px 6px; }
.stat-row .v { font-size: 21px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat-row .k { font-size: 12px; color: var(--ink2); margin-top: 2px; }

/* ---- 管理端 ---- */
/* 页签在 400px 宽的手机上必须全部可见：换行铺开，不用横向滚动 */
.adm-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.adm-tabs button {
  border: 1px solid var(--line); background: #fff; color: var(--ink2);
  border-radius: 999px; padding: 8px 15px; font-size: 13.5px; white-space: nowrap; cursor: pointer;
  flex: 0 0 auto; min-height: 40px;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.adm-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(20, 101, 78, .2); }
.adm-tabs button:last-child { margin-left: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line-2); padding: 8px 6px; text-align: left; }
table.grid th { color: var(--ink2); font-weight: 600; white-space: nowrap; }

/* 国标线下计分：完场成绩单 / 追分表 */
.gb-tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
table.gb-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.gb-tbl th, table.gb-tbl td {
  border-bottom: 1px solid var(--line-2); padding: 7px 5px;
  text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums;
}
table.gb-tbl thead th { color: var(--ink2); font-weight: 600; }
table.gb-tbl tbody th {
  text-align: left; color: var(--ink2); font-weight: 600;
  position: sticky; left: 0; background: var(--card);
}
table.gb-tbl tr.tot th, table.gb-tbl tr.tot td {
  border-top: 2px solid var(--line); font-weight: 700; color: var(--ink);
}
table.gb-tbl td.pos { color: var(--brand); }
table.gb-tbl td.neg { color: var(--danger); }
table.gb-tbl td.mut { color: var(--ink2); }

/* 国标线下计分：追分弹窗（按追分者分组） */
.gb-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(12, 30, 24, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.gb-modal {
  width: 100%; max-width: 390px;
  background: var(--card); border-radius: 20px; padding: 18px 16px 16px;
  box-shadow: var(--shadow-lg);
  max-height: 82vh; overflow-y: auto;
  animation: sheet-in var(--dur) var(--ease);
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.gb-modal h3 { margin: 0 0 10px; font-size: 16px; }
.gb-modal .btn { margin-top: 12px; width: 100%; }
.gb-chase-grp { margin-top: 12px; }
.gb-chase-grp + .gb-chase-grp { border-top: 1px solid var(--line-2); padding-top: 12px; }
.gb-chase-who { font-size: 14px; color: var(--ink); }
.gb-chase-who b { font-size: 15px; }
.qr-print { text-align: center; }
.qr-print canvas { border: 1px solid var(--line); border-radius: 10px; }
.edit-log { font-size: 12px; color: var(--ink2); background: var(--gold-weak); border-radius: 10px; padding: 9px 11px; margin-top: 8px; }
/* 等待队列（今日经营页）：编号 + 昵称 + 已等时长 + 移除按钮 */
.queue-list { margin-top: 8px; }
.queue-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line-2); }
.queue-row:first-child { border-top: none; }
.queue-no {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--brand); background: var(--brand-weak);
}
.queue-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-wait { flex: none; font-size: 12px; color: var(--ink2); }
.queue-row .btn.small { flex: none; margin: 0; }

/* ---- 役种速查 ---- */
.yk-intro h3 { margin-bottom: 6px; }
.yk-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.yk-open {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 7px; padding: 2px 7px 2px 4px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
/* 标识字形统一交给 CSS 呈现，避免不同手机 emoji 字体导致图标丢失 */
.yk-open .ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 4px;
  font-size: 10px; font-weight: 700; font-style: normal; color: #fff;
}
.yk-open.ok { background: #e7f3ec; color: #14654e; }
.yk-open.ok .ico { background: #14654e; }
.yk-open.down { background: #fdeee0; color: #a8560f; }
.yk-open.down .ico { background: #c4700f; }
.yk-open.no { background: #eceff4; color: #4a5b72; }
.yk-open.no .ico { background: #5b6c85; }
/* 食下减番是最需要一眼认出的（顾客最容易算错番），加一点描边强调 */
.yk-open.down { box-shadow: inset 0 0 0 1px #f0c99a; }

.yk-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.yk-chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink2);
  border-radius: 999px; padding: 7px 14px; font-size: 13.5px; white-space: nowrap; cursor: pointer;
  min-height: 36px;
}
.yk-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* 番数分段的标题：左侧色条，一眼区分档次 */
.yk-tier {
  border-left: 4px solid var(--line); padding-left: 8px; margin-bottom: 4px !important;
}
.yk-tier.gold { border-color: #c9a227; color: var(--gold-ink); }
.yk-tier.red { border-color: #c0392b; color: #a03024; }
.yk-tier.green { border-color: var(--brand); color: var(--brand); }
.yk-tier.gray { border-color: #9aa8a3; color: var(--ink2); }

.yk-item { border-top: 1px solid var(--line-2); padding: 11px 0; }
.yk-card .yk-item:first-of-type { border-top: none; }
.yk-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.yk-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.yk-han {
  flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--gold-ink);
  background: var(--gold-weak); border-radius: 7px; padding: 1px 7px;
}
.yk-meta { margin-top: 5px; }
.yk-desc { margin: 6px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink2); }

@media print {
  #topbar, #tabbar, #toast, #portalMask, #portalPanel, #scanMask, #scanPanel, .frame-shell, .no-print { display: none !important; }
  body { background: #fff; padding-bottom: 0; }
  .card { border: none; box-shadow: none; }
}

/* ---- 个人信息：余额卡（预存账户） ----
 * 放在页面最上方：顾客最关心的就是"我还剩多少钱"。
 * 数字用大字号 + 品牌绿底，和下面的战绩查询区明显分层。 */
.balance-card {
  position: relative; overflow: hidden;
  background:
    radial-gradient(110% 120% at 88% -20%, rgba(255, 255, 255, .16), transparent 58%),
    linear-gradient(140deg, #1b7356 0%, #0f4f3c 58%, #0a3b2c 100%);
  color: #fff;
  border: none;
  box-shadow: 0 12px 30px rgba(15, 64, 48, .24);
}
.balance-card::after {
  content: ''; position: absolute; right: -40px; bottom: -60px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 164, 92, .22), transparent 70%);
  pointer-events: none;
}
.balance-card .hint { color: rgba(255, 255, 255, .82); margin: 10px 0 0; position: relative; }
.bal-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; position: relative; }
.bal-main { flex: 1 1 auto; min-width: 0; }
.bal-label { font-size: 13px; opacity: .85; letter-spacing: 1px; }
.bal-num {
  font-size: 32px; font-weight: 700; line-height: 1.15; margin-top: 4px;
  font-variant-numeric: tabular-nums;          /* 数字等宽，跳动时不抖 */
  word-break: break-all;
}
.bal-side { flex: 0 0 auto; text-align: right; font-size: 12px; line-height: 1.9; }
.bal-side span { opacity: .8; margin-right: 6px; }
.bal-side b { font-weight: 600; font-variant-numeric: tabular-nums; }
.bal-owe { color: #ffd9a0; }                   /* 有欠费时高亮，别和余额混在一起 */

/* ---- 管理端：充值 / 停用 等行内操作 ---- */
.adm-row-act { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.adm-row-act .btn { flex: 0 0 auto; padding: 6px 12px; font-size: 13px; min-height: 34px; }
.bal-inline { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--brand); }
.tbl-off { opacity: .58; }                      /* 已停用的桌位行淡化 */
.tbl-off .t-name::after {
  content: '已停用'; margin-left: 6px; font-size: 12px;
  background: var(--line-2); color: var(--ink2);
  border-radius: 5px; padding: 1px 5px;
}
.sync-badge {
  display: inline-block; font-size: 12px; padding: 2px 8px;
  border-radius: 999px; background: var(--brand-weak); color: var(--brand);
}
.sync-badge.bad { background: var(--danger-weak); color: var(--danger); }

/* 品牌字：复用随包分发的马善政毛笔楷书子集（役满奖状同款内置字体，免费商用，
 * GB2312 子集对「雀」「迹」简体全覆盖）。font-display:swap 加载中先显示后备字体。 */
@font-face {
  font-family: "QJBrand";
  src: url("/assets/fonts/qj-cert-brush.woff2") format("woff2");
  font-display: swap;
}

/* ---- 登录 / 注册页（顾客端唯一入口，未登录一律先到这里） ---- */
body.qj-login #topbar { display: none; }       /* 登录页隐藏顶栏，品牌头直达屏幕顶 */
body.qj-login { padding-bottom: 24px; }
.lg-wrap { margin: -16px -14px 0; }            /* 抵掉 #app 的 padding，让品牌头图通栏 */

/* 品牌头：深绿多层渐变 + 光斑 + 牌面纹样，沉浸式首屏 */
.lg-hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(255, 255, 255, .14), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(74, 200, 150, .2), transparent 62%),
    linear-gradient(168deg, #1b7356 0%, #14513f 52%, #0b3a2c 100%);
  color: #fff; text-align: center;
  padding: calc(50px + env(safe-area-inset-top)) 18px 66px;
  border-radius: 0 0 30px 30px;
  margin-bottom: -38px;                        /* 白卡上浮，叠在圆角上形成层次 */
}
/* 右侧牌面纹样：用麻将牌 SVG 做低透明度水印，比 emoji 稳定、跨设备一致 */
.lg-hero::before {
  content: ''; position: absolute; right: -14px; bottom: -30px;
  width: 150px; height: 210px;
  background: url("/assets/tiles/chun.svg") center / contain no-repeat;
  opacity: .13; transform: rotate(-12deg); pointer-events: none;
}
.lg-hero::after {                              /* 左中辅助光斑 */
  content: ''; position: absolute; left: -46px; top: 34%;
  width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .09), transparent 70%);
  pointer-events: none;
}
.lg-logo {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 78px; height: 78px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 10px 24px rgba(0, 0, 0, .2);
}
.lg-logo img, .lg-logo svg { width: 42px; height: 59px; display: block; }
.lg-brand {
  margin-top: 16px;
  font-family: "QJBrand", "FZShuTi", "方正舒体", "STXingkai", "华文行楷", "KaiTi", "楷体", serif;
  font-size: 42px; font-weight: 400;
  letter-spacing: 8px; text-indent: 8px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .32);
}
.lg-hero .lg-sub {
  margin-top: 6px; font-size: 12px; letter-spacing: 3px;
  color: rgba(255, 255, 255, .66); text-indent: 3px;
}

.lg-wrap > .lg-card,
.lg-wrap > .lg-admin,
.lg-wrap > .lg-foot { margin-left: 14px; margin-right: 14px; }

/* 白卡上浮：压住品牌头圆角，视觉焦点 */
.lg-card {
  position: relative; z-index: 1;
  padding: 20px 18px 18px; border: none;
  border-radius: 22px;
  box-shadow: 0 18px 44px rgba(13, 58, 45, .18);
}

/* 登录 / 注册 分段控件 */
.lg-seg {
  display: flex; gap: 4px; margin: 0 0 18px;
  background: var(--bg-2); border-radius: 13px; padding: 4px;
}
.lg-seg-item {
  flex: 1; border: none; background: none; cursor: pointer;
  padding: 10px 0; border-radius: 10px; min-height: 44px;
  font-size: 15px; font-weight: 600; color: var(--ink2);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.lg-seg-item.on { background: #fff; color: var(--brand); box-shadow: 0 2px 8px rgba(13, 58, 45, .12); }

.lg-card .fld { margin-bottom: 14px; }
/* 填充式输入框：浅米底无边框，聚焦时白底 + 品牌描边 + 光晕 */
.lg-card input {
  background: #f7f4ec; border-color: transparent;
  border-radius: 13px; padding: 13px 15px;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.lg-card input:focus {
  background: #fff; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 101, 78, .14);
}
.lg-go {
  margin-top: 8px; border-radius: 14px; padding: 14px;
  letter-spacing: 4px; text-indent: 4px;
  background: linear-gradient(135deg, #1b7356, #0f4f3c);
  box-shadow: 0 8px 20px rgba(16, 80, 58, .28);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.lg-go:active { transform: scale(.985); box-shadow: 0 4px 10px rgba(16, 80, 58, .26); }
.lg-tip { margin: 14px 0 0; text-align: center; }

/* 店员入口：与顾客表单明确分开，避免顾客误点，但又要让店员一眼找到 */
.lg-admin {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; padding: 13px 15px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--ink);
}
.lg-admin:active { background: var(--brand-mist); }
.lg-admin-ico {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--brand-weak); color: var(--brand);
}
.lg-admin-ico svg { width: 20px; height: 20px; }
.lg-admin-txt { flex: 1; min-width: 0; line-height: 1.45; }
.lg-admin-txt b { display: block; font-size: 14px; font-weight: 600; }
.lg-admin-txt i { display: block; font-style: normal; font-size: 12px; color: var(--ink2); }
.lg-admin-go { flex: 0 0 auto; font-size: 20px; color: var(--ink3); }

.lg-foot { text-align: center; font-size: 12px; color: var(--ink2); margin: 16px 0 24px; }

/* ---- 管理端店员登录卡：与顾客端同款视觉语言 ---- */
.adm-login { text-align: center; padding-top: 24px; }
.adm-login-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 74px; height: 74px;
  background: linear-gradient(160deg, #1b7356, #0f4f3c);
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(15, 64, 48, .22);
}
.adm-login-logo img, .adm-login-logo svg { width: 38px; height: 53px; display: block; }
.adm-login-title {
  margin-top: 14px;
  font-family: "QJBrand", "FZShuTi", "方正舒体", "STXingkai", "华文行楷", "KaiTi", "楷体", serif;
  font-size: 30px; font-weight: 400;
  letter-spacing: 6px; text-indent: 6px; color: var(--ink);
}
.adm-login-sub { margin-top: 6px; font-size: 12.5px; color: var(--ink2); letter-spacing: 1px; }
.adm-login-card {
  margin-top: 22px; text-align: left; border: none;
  border-radius: 22px; padding: 20px 18px 18px;
  box-shadow: 0 18px 44px rgba(13, 58, 45, .12);
}
.adm-login-card .fld { margin-bottom: 14px; }
.adm-login-card input {
  background: #f7f4ec; border-color: transparent; border-radius: 13px;
  padding: 13px 15px; font-size: 20px; letter-spacing: 6px; text-align: center;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.adm-login-card input:focus {
  background: #fff; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 101, 78, .14);
}
.adm-login-go {
  margin-top: 6px; border-radius: 14px; padding: 14px;
  letter-spacing: 4px; text-indent: 4px;
  background: linear-gradient(135deg, #1b7356, #0f4f3c);
  box-shadow: 0 8px 20px rgba(16, 80, 58, .28);
}

/* ---- 管理端：通用表单弹框（改桌位名称 / 单价）---- */
.adm-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(12, 30, 24, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.adm-modal {
  width: 100%; max-width: 370px;
  background: var(--card); border-radius: 20px; padding: 18px 16px 16px;
  box-shadow: var(--shadow-lg);
  max-height: 80vh; overflow-y: auto;
  animation: sheet-in var(--dur) var(--ease);
}
.adm-modal h3 { margin: 0 0 12px; font-size: 16px; }
.adm-modal .fld { margin-bottom: 10px; }
.adm-modal .btn { margin-top: 0; }

/* ---- 账单页 / 玩家页：搜索工具条与筛选 ----
 * 按钮一律放在列表**上方**：店里几十号人时，列表要滚很久才够到底，
 * 「一键结账」埋在底下等于没有。 */
.adm-tools { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.adm-tools .fld { margin: 0; }
.adm-tools .btn { margin-top: 0; }

/* 分段筛选（全部 / 欠费 / 正常）：手指点得中的高度，选中态一眼可辨 */
.adm-seg { display: flex; gap: 6px; margin: 8px 0 2px; }
.adm-seg button {
  flex: 1; padding: 9px 6px; font-size: 13px; min-height: 44px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink2);
  border-radius: 10px; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.adm-seg button.on {
  background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600;
}

/* 今日经营日报条迷你卡（v0.14）：六格一眼看全今天的生意 */
.today-mini {
  flex: 1 1 120px; min-width: 104px;
  background: var(--brand-mist);
  border: 1px solid rgba(20, 101, 78, .08);
  border-radius: 12px; padding: 9px 11px;
}
.today-mini .l { font-size: 12px; color: var(--ink2); }
.today-mini .v { font-size: 18px; font-weight: 700; color: var(--brand); margin-top: 2px; font-variant-numeric: tabular-nums; }
.today-mini .s { font-size: 12px; color: var(--ink2); margin-top: 2px; }
.today-mini.link { cursor: pointer; }
.today-mini.link .v { color: var(--danger); }

/* 负余额 = 欠费，必须和"预存的钱"一眼区分开（红） */
.bal-neg { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--danger); }

/* ---- 役满奖状：牌池与已选手牌 ---- */
.cert-pool { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin-top: 8px; }
.cert-pool img { width: 100%; cursor: pointer; border-radius: 4px; transition: transform var(--dur-fast) var(--ease); }
.cert-pool img:active { transform: scale(.92); }
.cert-hand { display: flex; flex-wrap: wrap; gap: 4px; min-height: 52px; padding: 6px;
  background: #faf8f2; border: 1px dashed var(--line); border-radius: 10px; margin-top: 6px; }
.cert-hand img { width: 36px; cursor: pointer; border-radius: 4px; }
.cert-canvas { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #f2ecd9; }

/* ---- 役满奖状：可搜索玩家选择器（人多时原生 select 拉不到底，改用输入框实时过滤） ---- */
.ppick { position: relative; }
.ppick-input { width: 100%; }
.ppick-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 20;
  max-height: 46vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-md); padding: 4px;
}
.ppick-item { padding: 9px 10px; border-radius: 9px; font-size: 14px; cursor: pointer; }
.ppick-item:hover, .ppick-item.on { background: var(--brand-weak); color: var(--brand); }
.ppick-empty { padding: 9px 10px; font-size: 13px; color: var(--ink2); }
/* 已发布列表行内的选择器：限宽，避免把「删除」挤出屏幕（.row > * 默认 flex:1） */
.row .ppick-host { flex: 1 1 120px; max-width: 42%; }

/* ---- 竞技精算：录入面板 / 实时预览 / 战绩精算行 ---- */
.settle-box { border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; background: #fdfcf8; }
.settle-box summary { cursor: pointer; font-weight: 600; }
.settle-head { margin: 0 0 4px; font-weight: 700; color: var(--ink); }
.settle-preview { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.settle-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; border-radius: 9px; background: var(--brand-weak);
  font-size: 13.5px;
}
.settle-row > span:first-child { flex: 0 0 auto; min-width: 30px; font-weight: 700; color: var(--brand); }
.settle-row .hint { flex: 1; text-align: right; color: var(--ink2); font-size: 12.5px; }
.settle-row b { flex: 0 0 auto; min-width: 78px; text-align: right; font-variant-numeric: tabular-nums; }
.settle-table .settle-row { margin-bottom: 4px; }

/* ---- 拍照识别模态框 ---- */
.detect-modal {
  /* 全屏弹层（手机友好），桌面居中也不突兀 */
  inset: 0 !important; max-width: none !important; max-height: none !important;
  border-radius: 0 !important;
  display: flex !important; flex-direction: column !important;
  padding: 0 !important; overflow: hidden !important;
}
.detect-modal .detect-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--card);
}
.detect-modal .detect-header h3 { margin: 0; font-size: 16px; }
.detect-modal .detect-close-x {
  border: none; background: var(--bg); font-size: 22px; color: var(--ink2);
  cursor: pointer; width: 36px; height: 36px; border-radius: 10px;
}
.detect-modal .detect-hint {
  padding: 8px 16px; font-size: 12.5px; color: var(--ink2);
  border-bottom: 1px solid var(--line); background: var(--card);
}
.detect-modal .detect-btn-bar {
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
/* 首次使用的引擎下载进度条 */
.detect-modal .detect-prep { margin-top: 10px; }
.detect-modal .detect-prep-row {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 12.5px; color: var(--ink2); margin-bottom: 6px;
}
.detect-modal .detect-prep-row b {
  font-variant-numeric: tabular-nums; color: var(--ink); font-size: 13px;
}
.detect-modal .detect-prep-track {
  height: 8px; border-radius: 4px; background: var(--line); overflow: hidden;
}
.detect-modal .detect-prep-fill {
  height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, #1b7356, #2fae7d);
  transition: width .18s ease-out;
}
.detect-modal .detect-prep-note {
  margin: 6px 0 0; font-size: 12px; color: var(--ink2); line-height: 1.5;
}
.detect-modal .detect-stage {
  flex: 1 1 auto; overflow: auto; background: #141a17;
  display: flex; align-items: center; justify-content: center;
  /* flexbox 经典坑：不加 min-height:0 会被 canvas 撑爆整个 modal，header 被挤出屏幕 */
  min-height: 0;
}
.detect-modal .detect-stage img,
.detect-modal .detect-stage canvas {
  /* key：max-height 限制在 stage 内，横图/竖图都能自适应 */
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  display: block;
}
.detect-modal .detect-result {
  flex: 0 0 auto; background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.detect-modal .detect-result h4 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
/* 识别牌列表：横向滚动一行排开，手指能滑 */
.detect-modal .detect-picks {
  display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin;
  padding: 2px 2px 8px;
}
.detect-modal .detect-picks::-webkit-scrollbar { height: 4px; }
.detect-modal .detect-picks::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
/* 显式给宽高 —— aspect-ratio 在 flex 容器里需要 width 才能起作用 */
.detect-modal .detect-pick {
  flex: 0 0 34px; width: 34px; height: 48px; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease);
}
.detect-modal .detect-pick:active { transform: scale(.92); }
/* 空状态提示 */
.detect-modal .detect-picks-empty { padding: 12px 0; text-align: center; color: var(--ink2); font-size: 13px; }
/* 底部按钮区：主按钮占满宽度，次按钮一行 ghost */
.detect-modal .detect-actions { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.detect-modal .detect-actions .btn { margin-top: 0; }
.detect-modal .detect-actions .btn.detect-fill {
  background: linear-gradient(135deg, #1b7356, #0f4f3c);
  box-shadow: 0 4px 12px rgba(20, 101, 78, .26);
  border: none; color: #fff; font-weight: 600; letter-spacing: 2px;
}
.detect-modal .detect-actions .detect-sub {
  display: flex; gap: 8px;
}
.detect-modal .detect-actions .detect-sub .btn { flex: 1; }

/* ---- 大屏适度加宽（手机上完全不受影响） ---- */
@media (min-width: 640px) {
  #app { max-width: 640px; padding: 20px 16px 10px; }
  .table-grid { grid-template-columns: repeat(3, 1fr); }
  .lg-wrap { margin: -20px -16px 0; }
}

/* ---- 管理端桌面布局（收银机 / 大屏 ≥900px）----
 * 手机上仍是上下单栏；宽屏时把页签变成左侧竖排导航，右侧放业务内容，
 * 避免 1280 的收银机屏幕上还是一条 640px 窄栏、每天上下滚。 */
@media (min-width: 900px) {
  body.admin { padding-bottom: 24px; }
  body.admin #app { max-width: 1180px; padding: 24px; }
  body.admin #app:has(> .adm-tabs) {
    display: grid;
    grid-template-columns: 188px minmax(0, 1fr);
    gap: 0 24px;
    align-items: start;
  }
  body.admin #app > .adm-tabs {
    flex-direction: column; flex-wrap: nowrap;
    gap: 6px; margin-bottom: 0;
    position: sticky; top: calc(var(--topbar-h) + 24px);
  }
  body.admin #app > .adm-tabs button {
    width: 100%; text-align: left; border-radius: 12px;
    padding: 10px 14px; min-height: 44px;
  }
  body.admin #app > .adm-tabs button:last-child { margin-left: 0; margin-top: 12px; }
  body.admin #admBody { min-width: 0; }
  /* 登录页仍是居中单卡，不被两栏网格拉成半屏 */
  body.admin .adm-login { max-width: 460px; margin: 0 auto; }
}

/* ---- 减少动态效果偏好 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
