/* H5 游戏站 - 公共样式 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #f0f0f0;
  color: #333;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; border: none; outline: none; }
img { max-width: 100%; display: block; }

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f5f5f5;
  position: relative;
}

/* 顶栏 */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-bar .back {
  position: absolute;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #333;
  font-size: 15px;
  cursor: pointer;
  padding: 8px 0;
}
.nav-bar .back svg { width: 18px; height: 18px; }
.nav-bar .title { font-size: 17px; font-weight: 500; }
.nav-bar .action {
  position: absolute;
  right: 14px;
  font-size: 15px;
  color: #666;
  cursor: pointer;
}

/* 登录页 */
.login-page {
  background: #f5f5f5;
  padding: 60px 24px 40px;
  min-height: 100vh;
}
.login-title {
  text-align: center;
  font-size: 26px;
  font-weight: 500;
  color: #444;
  margin-bottom: 48px;
}
.form-row {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 0 16px;
  height: 52px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.form-row label {
  width: 56px;
  font-size: 15px;
  color: #333;
  flex-shrink: 0;
}
.form-row input {
  flex: 1;
  height: 100%;
  font-size: 15px;
  color: #333;
  background: transparent;
}
.form-row input::placeholder { color: #bbb; }

.login-sub {
  text-align: center;
  font-size: 13px;
  color: #888;
  margin: -36px 0 28px;
}
.login-footer-link {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
}
.login-footer-link a { color: #f5922a; }

.btn-primary {
  display: block;
  width: 100%;
  height: 50px;
  line-height: 50px;
  text-align: center;
  background: linear-gradient(180deg, #ffb347 0%, #f5922a 100%);
  color: #fff;
  font-size: 17px;
  border-radius: 25px;
  margin-top: 32px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 146, 42, .35);
}
.btn-primary:active { opacity: .9; }

/* 列表页 */
.list-group { margin: 12px 0; background: #fff; }
.list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
  cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item .label { flex: 1; }
.list-item .value { color: #999; font-size: 14px; margin-right: 4px; }
.list-item .arrow { color: #ccc; font-size: 18px; }

.profile-header {
  display: flex;
  align-items: center;
  padding: 20px 16px;
  background: #fff;
  margin-bottom: 12px;
}
.profile-header .avatar {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffd89b, #f5a623);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-right: 14px;
}
.profile-header .info .name { font-size: 16px; font-weight: 500; }
.profile-header .info .uid { font-size: 13px; color: #999; margin-top: 4px; }

.btn-logout {
  display: block;
  width: calc(100% - 32px);
  margin: 24px 16px;
  height: 48px;
  line-height: 48px;
  text-align: center;
  background: #fff;
  color: #f5922a;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
}

/* 表格 */
.data-table { width: 100%; background: #fff; font-size: 13px; }
.data-table thead { background: #fafafa; color: #666; }
.data-table th, .data-table td {
  padding: 10px 6px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}
.data-table tbody tr:active { background: #fafafa; }

/* 历史开奖 - 点击展开牌面 */
.history-table .history-row { cursor: pointer; }
.history-table .history-row.expanded { background: #fff8ef; }
.history-expand-icon {
  display: inline-block;
  width: 12px;
  color: #999;
  font-size: 11px;
}
.history-detail-row td {
  padding: 0 !important;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}
.history-detail-row .history-cards-area {
  --card-w: min(40px, calc((100vw - 32px) / 4.5));
  margin: 0;
  padding: 8px 4px 10px;
  background: #fff;
  border: none;
  border-radius: 0;
}
.history-no-cards {
  padding: 12px;
  text-align: center;
  color: #999;
  font-size: 12px;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: #bbb;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }

.date-picker-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: 14px;
  background: #fff;
  border-top: 1px solid #eee;
  text-align: center;
  font-size: 15px;
  color: #333;
}

/* Tab */
.tab-bar {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #eee;
}
.tab-bar .tab {
  flex: 1;
  text-align: center;
  padding: 12px;
  font-size: 15px;
  color: #666;
  cursor: pointer;
}
.tab-bar .tab.active {
  color: #fff;
  background: #f5922a;
}
.summary-bar {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  background: #fff;
  font-size: 14px;
  color: #666;
  border-bottom: 1px solid #eee;
}
.summary-bar span b { color: #333; }

/* 规则页 */
.rules-content {
  padding: 16px;
  background: #fff;
  font-size: 14px;
  line-height: 1.8;
  color: #444;
}
.rules-content h3 { font-size: 16px; margin: 16px 0 8px; color: #333; }
.rules-content p { margin-bottom: 8px; text-indent: 0; }
.rules-content .rules-tables { text-align: center; line-height: 1.9; color: #8b6914; font-weight: 600; }
.rules-content .rules-example-title { margin-top: 12px; font-weight: 600; color: #333; }
.rules-draw-table {
  width: 100%;
  max-width: 240px;
  margin: 8px auto 12px;
  border-collapse: collapse;
  text-align: center;
  font-size: 14px;
}
.rules-draw-table th,
.rules-draw-table td {
  border: 1px solid #ddd;
  padding: 8px 12px;
}
.rules-draw-table th { background: #f5f5f5; color: #666; }
.rules-split-list {
  margin: 0 0 12px;
  padding-left: 20px;
  line-height: 1.85;
}
.rules-split-list li { margin-bottom: 4px; }

/* 账号资料 / 修改密码 */
.page-account { padding-bottom: 24px; }

.account-hero {
  margin: 12px 16px;
  padding: 28px 16px 22px;
  background: #fff;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.avatar-upload-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto;
}
.account-hero .avatar-lg {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe4b8, #f5a623);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(245, 146, 42, 0.35);
  cursor: pointer;
}
.account-hero .avatar-lg img {
  border-radius: 50%;
}
.avatar-camera-btn {
  position: absolute;
  right: -2px;
  bottom: 2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: linear-gradient(180deg, #ffb347, #f5922a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.avatar-camera-btn svg { width: 16px; height: 16px; }
.avatar-tip {
  margin-top: 12px;
  font-size: 12px;
  color: #aaa;
}

.account-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 16px;
  padding: 14px 14px;
  background: #fff8ee;
  border: 1px solid #ffe0b8;
  border-radius: 10px;
}
.account-notice svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: #f5922a;
  margin-top: 2px;
}
.account-notice .notice-title {
  font-size: 14px;
  font-weight: 600;
  color: #b36b00;
  margin-bottom: 4px;
}
.account-notice .notice-desc {
  font-size: 12px;
  color: #996515;
  line-height: 1.5;
}

.form-card {
  margin: 0 16px 12px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.form-field {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f3f3;
}
.form-field:last-child { border-bottom: none; }
.form-field .field-label {
  display: block;
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
}
.form-field-readonly .field-value {
  font-size: 15px;
  color: #333;
  font-weight: 500;
  word-break: break-all;
}
.field-input-wrap {
  display: flex;
  align-items: center;
  background: #f7f7f7;
  border-radius: 8px;
  padding: 0 12px;
  min-height: 44px;
}
.field-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  font-size: 15px;
  color: #333;
  background: transparent;
}
.field-input::placeholder { color: #bbb; }
.field-eye {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.55;
  line-height: 1;
}
.field-eye.on { opacity: 1; }

.form-hint {
  margin: 0 16px 8px;
  font-size: 12px;
  color: #aaa;
  line-height: 1.5;
}

.page-form-footer {
  padding: 8px 16px 0;
}
.btn-block {
  width: 100%;
  margin-top: 0;
}
.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* 兼容旧类名 */
.avatar-edit { text-align: center; padding: 30px 0 20px; background: #fff; }
.avatar-edit .avatar-lg {
  width: 88px; height: 88px; border-radius: 50%;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, #ffd89b, #f5a623);
  display: flex; align-items: center; justify-content: center; font-size: 44px;
}
.avatar-edit .change-link { color: #f5922a; font-size: 14px; cursor: pointer; }
.tip-text { padding: 12px 16px; font-size: 13px; color: #999; background: #fff; }
.pwd-hint { padding: 8px 16px 16px; font-size: 12px; color: #999; }

/* 玩家列表 */
.player-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #f5f5f5;
  font-size: 14px;
}
.player-row .idx { width: 28px; color: #999; }
.player-row .avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a8e6cf, #88d8b0);
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.player-row .mid { flex: 1; }
.player-row .status { color: #52c41a; font-size: 13px; }

.table-header-row {
  display: flex;
  background: #fafafa;
  padding: 10px 16px;
  font-size: 13px;
  color: #999;
  border-bottom: 1px solid #eee;
}
.table-header-row span { flex: 1; text-align: center; }
.table-header-row span:first-child { text-align: left; flex: .5; }

/* ========== 游戏主界面（深色 UI） ========== */
.game-page {
  --game-bg: #121212;
  --game-bg-elevated: #1a1a1a;
  --game-bg-card: #222;
  --game-border: #333;
  --game-border-light: #3a3a3a;
  --game-text: #e8e8e8;
  --game-gold: #e8d5a3;
  --game-gold-dim: #9a8860;
  --game-accent: #f5922a;
  background: var(--game-bg);
  min-height: 100vh;
  padding-bottom: 140px;
  color: var(--game-text);
}

.game-top {
  background: linear-gradient(180deg, #1f1f1f 0%, #121212 100%);
  padding: 8px 12px 6px;
  color: var(--game-gold);
  border-bottom: 1px solid var(--game-border);
}
.game-top-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.game-period { font-size: 14px; color: var(--game-gold); }
.game-result {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ball {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffb347, #f5922a);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}
.countdown { color: #ff6b6b; font-size: 18px; font-weight: bold; min-width: 52px; text-align: center; }
.game-user-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--game-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  overflow: hidden;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}
.game-user-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
/* 余额 | 游戏状态 | ID 同一行 */
.game-top-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
}
.game-top-status-row .balance-box {
  flex: 0 1 28%;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  min-width: 0;
  white-space: nowrap;
}
.game-top-status-row .game-user-id {
  flex: 0 1 28%;
  font-size: 11px;
  text-align: right;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--game-gold-dim);
}
.game-top-status-row .game-status-bar {
  flex: 1 1 44%;
  min-width: 0;
  text-align: center;
  padding: 0;
  margin: 0;
}
.game-top-status-row .game-status-bar span {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 5px 6px;
  background: linear-gradient(90deg, #2a2418, #4a3d20, #2a2418);
  color: var(--game-gold);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 6px;
  border: 1px solid rgba(232, 213, 163, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.balance-box { display: flex; align-items: center; gap: 5px; color: var(--game-gold); }
.coin-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  line-height: 0;
}
.coin-icon svg {
  display: block;
  width: 18px;
  height: 18px;
}

.marquee-bar {
  margin: 6px 12px 8px;
  padding: 0;
  min-height: 32px;
  background: var(--game-bg-elevated);
  border: 1px solid var(--game-border);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--game-gold-dim);
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
.marquee-icon {
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  background: rgba(0,0,0,.35);
  border-right: 1px solid var(--game-border);
  position: relative;
}
.marquee-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.marquee-track {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 8px 10px 8px 4px;
  position: relative;
}
.marquee-bar .text {
  display: inline-block;
  white-space: nowrap;
  animation: marquee 18s linear infinite;
  will-change: transform;
}
@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

.cards-area {
  /* 8 张牌 50% 横向重叠：总宽 ≈ 4.5 × 牌宽，尽量撑满屏幕 */
  --card-w: min(72px, calc((100vw - 36px) / 4.5));
  --card-h: calc(var(--card-w) * 726 / 500);
  --card-overlap-x: calc(var(--card-w) * 0.5);
  --card-overlap-y: calc(var(--card-h) * 0.5);
  margin: 0 8px 10px;
  padding: 10px 8px 12px;
  background: var(--game-bg-elevated);
  border: 1px solid var(--game-border);
  border-radius: 8px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cards-row {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 0;
}
.cards-row:not(:first-child) {
  margin-top: calc(-1 * var(--card-overlap-y));
}
.cards-row:last-child { margin-bottom: 0; }
.playing-card {
  position: relative;
  flex: 0 0 auto;
  width: var(--card-w);
  max-width: var(--card-w);
  min-width: 0;
  margin-left: calc(-1 * var(--card-overlap-x));
  aspect-ratio: 500 / 726;
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
}
.cards-row .playing-card:first-child {
  margin-left: 0;
}
.playing-card .card-img {
  width: 100%;
  height: 100%;
  display: block;
  background: #fff;
  object-fit: contain;
  object-position: center;
}
.mini-card-wrap {
  width: 32px;
  aspect-ratio: 500 / 726;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  overflow: hidden;
  line-height: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.mini-card-wrap .card-img-mini {
  width: 100%;
  height: 100%;
  display: block;
  background: #fff;
  object-fit: contain;
  object-position: center;
}
/* 结算区小牌：叠放显示，节省横向空间 */
.settle-table .cards-mini {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 54px;
  height: 38px;
  margin: 2px auto 6px;
  padding: 0;
  gap: 0;
}
.settle-table .cards-mini .mini-card-wrap {
  width: 26px;
  flex-shrink: 0;
  margin: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.settle-table .cards-mini .mini-card-wrap:not(:first-child) {
  margin-left: -11px;
}
.settle-table .cards-mini .mini-card-wrap:nth-child(1) { z-index: 1; transform: rotate(-4deg); }
.settle-table .cards-mini .mini-card-wrap:nth-child(2) { z-index: 2; transform: rotate(0deg); }
.settle-table .cards-mini .mini-card-wrap:nth-child(3) { z-index: 3; transform: rotate(4deg); }

.game-nav {
  display: flex;
  justify-content: space-around;
  padding: 8px 4px;
  background: var(--game-bg-elevated);
  border: 1px solid var(--game-border);
  margin: 0 8px 10px;
  border-radius: 8px;
}
.game-nav-item {
  text-align: center;
  cursor: pointer;
  color: var(--game-gold-dim);
  font-size: 10px;
}
.game-nav-item .icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3a3428 0%, #252018 55%, #1a1610 100%);
  margin: 0 auto 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(232, 213, 163, 0.25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.game-nav-item:active .icon-circle {
  transform: scale(0.94);
}
.game-nav-item .icon-circle .nav-svg {
  width: 18px;
  height: 18px;
  display: block;
}
.game-nav-item .icon-circle.icon-circle-danger {
  background: linear-gradient(145deg, #c45c5c 0%, #8b3030 55%, #6b2424 100%);
  border-color: rgba(255, 200, 200, 0.45);
}
.game-nav-cancel { color: #f0c4c4; }

.bet-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 10px 12px;
}
.bet-cell {
  background: var(--game-bg-card);
  border-radius: 8px;
  text-align: center;
  padding: 8px 4px 6px;
  cursor: pointer;
  border: 2px solid var(--game-border);
  transition: border-color .2s, background .2s;
}
.bet-cell.selected {
  border-color: var(--game-accent);
  background: #2a2218;
  box-shadow: 0 0 0 1px rgba(245, 146, 42, 0.25);
}
.bet-cell .bet-amount { font-size: 12px; color: var(--game-accent); min-height: 18px; }
.bet-cell .table-no { font-size: 28px; color: var(--game-gold); font-weight: 300; line-height: 1.2; }
.bet-cell .view-bet {
  font-size: 11px;
  color: #777;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--game-border);
}

.bet-footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--game-bg-elevated);
  border-top: 1px solid var(--game-border);
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
}
.quick-amounts {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
.quick-amounts button {
  flex: 1;
  min-width: 0;
  height: 36px;
  background: var(--game-bg-card);
  color: var(--game-gold-dim);
  border: 1px solid var(--game-border);
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}
.quick-amounts button:active { background: #2e2e2e; }
.quick-amounts .bet-amount-input {
  flex: 1.8;
  min-width: 0;
  width: 0;
  height: 36px;
  background: var(--game-bg-card);
  border: 1px solid var(--game-border-light);
  border-radius: 4px;
  padding: 0 8px;
  font-size: 13px;
  color: var(--game-gold);
  text-align: center;
}
.quick-amounts .bet-amount-input::placeholder {
  color: #666;
  font-size: 12px;
}
.btn-confirm-bet {
  width: 100%;
  height: 44px;
  background: linear-gradient(180deg, #c4a035, #8b6914);
  color: #fff8dc;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.btn-confirm-bet:active { opacity: 0.92; }

/* 首页深色：两侧背景与弹窗 */
body:has(.game-page) {
  background: #121212;
}
#modal-cancel .modal-box {
  background: #1f1f1f;
  border: 1px solid #333;
}
#modal-cancel .modal-box .modal-title {
  color: #e8d5a3;
}
#modal-cancel .modal-box .modal-body {
  color: #999;
}
#modal-cancel .modal-box .modal-actions {
  border-top-color: #333;
}
#modal-cancel .modal-box .modal-actions button {
  background: #1f1f1f;
  color: #bbb;
}
#modal-cancel .modal-box .modal-actions button.confirm {
  color: #f5922a;
  border-left-color: #333;
}

/* 下注详情 8桌 */
.bet-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}
.bet-detail-cell {
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
}
.bet-detail-cell.highlight { border-color: #f5922a; box-shadow: 0 0 0 2px rgba(245,146,42,.3); }
.bet-detail-cell .hd {
  background: #e8e8e8;
  text-align: center;
  padding: 8px;
  font-size: 14px;
  color: #666;
}
.bet-detail-cell .sum {
  text-align: center;
  padding: 6px;
  font-size: 13px;
  color: #f5922a;
  border-bottom: 1px solid #f0f0f0;
}
.bet-detail-cell .list {
  min-height: 80px;
  max-height: 160px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
  font-size: 12px;
  color: #666;
}
.bet-detail-cell .list-load-tip {
  text-align: center;
  padding: 6px 0 2px;
  font-size: 11px;
  color: #bbb;
}
.bet-detail-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed #f0f0f0;
}
.bet-detail-item .bet-detail-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bet-detail-item .bet-detail-time { color: #999; font-size: 11px; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.bet-detail-item .bet-detail-amt { color: #333; font-weight: 500; min-width: 32px; text-align: right; }
/* 弹层 */
.modal-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-mask.show { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 320px;
  overflow: hidden;
}
.modal-box .modal-title { padding: 18px; text-align: center; font-size: 16px; }
.modal-box .modal-body { padding: 0 20px 20px; text-align: center; color: #666; font-size: 14px; }
.modal-box .modal-actions {
  display: flex;
  border-top: 1px solid #eee;
}
.modal-box .modal-actions button {
  flex: 1;
  height: 48px;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
}
.modal-box .modal-actions button.confirm { color: #f5922a; border-left: 1px solid #eee; }

/* 结算页/弹层 */
.settlement-page { background: #1a1a1a; color: #e8d5a3; }
.page.settlement-page { min-height: 100vh; }
.settlement-header {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  position: relative;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
  background: #1a1a1a;
}
.settlement-header .close-btn {
  position: absolute;
  right: 12px;
  color: #aaa;
  font-size: 14px;
  cursor: pointer;
}
.settlement-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 8px;
}
.settle-table {
  background: #2a2a2a;
  border-radius: 6px;
  padding: 6px 2px 8px;
  text-align: center;
  font-size: 10px;
  min-width: 0;
  overflow: hidden;
}
.settle-table .t-title {
  color: #c4a035;
  margin-bottom: 4px;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}
.settle-table .points {
  color: #f5922a;
  font-size: 11px;
  font-weight: bold;
  line-height: 1.2;
}
.settle-table.winner { border: 2px solid #f5922a; box-shadow: 0 0 8px rgba(245,146,42,.4); }
.settle-table.winner .t-title { color: #f5922a; }

/* 上轮记录整页：牌面略放大，仍叠放不撑破格子 */
.page.settlement-page .settle-table .cards-mini {
  width: 100%;
  max-width: 86px;
  height: 52px;
  margin: 4px auto 5px;
}
.page.settlement-page .settle-table .cards-mini .mini-card-wrap {
  width: 34px;
}
.page.settlement-page .settle-table .cards-mini .mini-card-wrap:not(:first-child) {
  margin-left: -14px;
}
.page.settlement-page .settle-table {
  padding: 6px 1px 8px;
}
.page.settlement-page .settle-table .t-title {
  font-size: 9px;
  margin-bottom: 2px;
}
.page.settlement-page .settle-table .points {
  font-size: 10px;
  line-height: 1.15;
}

/* 结算弹窗：顶栏/底栏固定，中间滚动 */
#modal-settle {
  align-items: center;
  padding: 12px;
}
#modal-settle .settlement-modal {
  width: 100%;
  max-width: 480px;
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
#modal-settle .settlement-modal-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#modal-settle .settlement-modal-footer {
  flex-shrink: 0;
  border-top: 1px solid #333;
  background: #1a1a1a;
  padding-bottom: env(safe-area-inset-bottom);
}
#modal-settle .settlement-modal-footer .settle-total {
  padding: 10px 12px 0;
}
#modal-settle .settlement-modal-footer .btn-settle-ok {
  margin: 10px 12px 12px;
  width: calc(100% - 24px);
}

/* 结算弹窗内 8 桌一屏展示 */
#modal-settle .settlement-grid {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 360px) {
  .settlement-grid {
    gap: 4px;
    padding: 8px 4px;
  }
  .settle-table .cards-mini .mini-card-wrap {
    width: 22px;
  }
  .settle-table .cards-mini .mini-card-wrap:not(:first-child) {
    margin-left: -9px;
  }
  .settle-table .cards-mini {
    width: 46px;
    height: 34px;
  }
  .page.settlement-page .settle-table .cards-mini .mini-card-wrap {
    width: 28px;
  }
  .page.settlement-page .settle-table .cards-mini .mini-card-wrap:not(:first-child) {
    margin-left: -11px;
  }
  .page.settlement-page .settle-table .cards-mini {
    max-width: 72px;
    height: 44px;
  }
}

.settle-info-bar {
  text-align: center;
  padding: 12px;
  font-size: 14px;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
}
.settle-info-bar .balls { display: inline-flex; gap: 4px; margin: 0 6px; vertical-align: middle; }
.settle-info-bar .ball-sm {
  width: 22px; height: 22px; border-radius: 50%;
  background: #f5922a; color: #fff; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}

.settle-bet-list { padding: 12px; }
.settle-table-block {
  border-bottom: 1px solid #333;
  margin-bottom: 4px;
}
.settle-table-block:last-child { border-bottom: none; }
.settle-bet-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0 6px;
  font-size: 13px;
}
.settle-table-head {
  font-weight: bold;
  color: #e8d5a3;
  padding-bottom: 4px;
}
.settle-bet-cols {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 4px;
  align-items: center;
  padding: 6px 0;
  font-size: 12px;
  color: #bbb;
}
.settle-bet-cols span {
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settle-bet-cols .col-name { text-align: left; color: #ccc; }
.settle-bet-cols-head {
  color: #888;
  font-size: 11px;
  padding: 0 0 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid #333;
}
.settle-user-row {
  border-top: 1px dashed #2a2a2a;
}
.settle-table-block .settle-user-row:first-of-type { border-top: none; }
.col-settle.col-settle-win { color: #52c41a; }
.col-settle.col-settle-lose { color: #ff7875; }
.settle-bet-row .empty { color: #666; font-style: italic; }
.settle-total {
  display: flex;
  justify-content: space-between;
  padding: 14px 12px;
  font-size: 15px;
  font-weight: bold;
  color: #f5922a;
}
.btn-settle-ok {
  display: block;
  width: calc(100% - 24px);
  margin: 12px;
  height: 46px;
  line-height: 46px;
  text-align: center;
  background: linear-gradient(180deg, #c4a035, #8b6914);
  color: #fff8dc;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}

/* 导航索引 */
.sitemap { padding: 20px 16px; }
.sitemap h1 { font-size: 20px; margin-bottom: 8px; }
.sitemap p { font-size: 13px; color: #999; margin-bottom: 20px; }
.sitemap a {
  display: block;
  padding: 14px 16px;
  background: #fff;
  margin-bottom: 8px;
  border-radius: 8px;
  font-size: 15px;
}
.sitemap a span { color: #999; font-size: 12px; display: block; margin-top: 2px; }

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,.75);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 999;
  display: none;
}
.toast.show { display: block; }

/* 邀请中心 */
.invite-stats {
  display: flex;
  background: linear-gradient(135deg, #ffb347, #f5922a);
  margin: 12px;
  border-radius: 10px;
  padding: 16px 8px;
  color: #fff;
}
.invite-stat-item { flex: 1; text-align: center; }
.invite-stat-item .num { display: block; font-size: 20px; font-weight: 600; }
.invite-stat-item .lbl { font-size: 12px; opacity: .9; }
.invite-card {
  background: #fff;
  margin: 12px;
  border-radius: 10px;
  padding: 14px 16px;
}
.invite-card-title { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 8px; }
.invite-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f8f8;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #f5922a;
}
.btn-copy {
  border: none;
  background: #f5922a;
  color: #fff;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 14px;
  cursor: pointer;
}
.btn-copy.full { width: 100%; margin-top: 10px; height: 40px; border-radius: 20px; font-size: 14px; }
.invite-link-box {
  font-size: 12px;
  color: #666;
  word-break: break-all;
  background: #f8f8f8;
  padding: 10px;
  border-radius: 8px;
  line-height: 1.5;
}
.invite-hint { font-size: 12px; color: #999; margin-top: 10px; line-height: 1.6; }
.invite-tier-list { margin: 0; padding-left: 18px; font-size: 13px; color: #666; line-height: 1.8; }
.invitee-list { max-height: 280px; overflow-y: auto; }
.invitee-item { padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.invitee-item:last-child { border-bottom: none; }
.invitee-name { font-size: 15px; color: #333; }
.invitee-meta { font-size: 12px; color: #999; margin-top: 4px; }
.invitee-empty { text-align: center; color: #ccc; padding: 24px 0; font-size: 13px; }

/* 余额流水列表页 */
.balance-log-list { background: #fff; margin-top: 8px; }
.balance-log-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.balance-log-item:last-child { border-bottom: none; }
.balance-log-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.balance-log-time { color: #666; flex-shrink: 0; }
.balance-log-amount { font-weight: 600; flex: 1; text-align: right; }
.balance-log-type {
  font-size: 12px;
  color: #999;
  background: #f5f5f5;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.balance-log-remark {
  font-size: 12px;
  color: #aaa;
  margin-top: 6px;
  line-height: 1.4;
}
.balance-log-after {
  font-size: 11px;
  color: #ccc;
  margin-top: 4px;
}
.pager-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: #fff;
  margin-top: 12px;
  border-top: 1px solid #f0f0f0;
}
.pager-btn {
  min-width: 88px;
  height: 36px;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 18px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}
.pager-btn:disabled {
  color: #ccc;
  border-color: #eee;
  cursor: not-allowed;
}
.pager-btn:not(:disabled):active { background: #f5f5f5; }
.pager-info { font-size: 14px; color: #666; }
