/* ==========================================================================
   功夫牛牛 mini app — per-screen styles
   Loaded after style.css, which owns the tokens and shared components.
   Every screen here is matched against the live reference captures in
   .scratch/ref2/ rather than designed from scratch.
   ========================================================================== */

/* ==========================================================================
   Lobby
   ========================================================================== */

.lobby-container { padding: 4px 0 0; }
.lobby-title { display: none; } /* the shell header already shows 游戏大厅 */

.announcement-section { padding: 12px 16px 0; }
.announcement-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.announcement-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
}
.announcement-title .icon { width: 19px; height: 19px; color: var(--text-2); }
.announcement-page { font-size: 13px; color: var(--text-mute); font-variant-numeric: tabular-nums; }

/* Fallback banner, used only until the generated artwork lands. */
.promo-banner {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-lg);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 70% 30%, rgba(124, 58, 237, .5), transparent 60%),
    linear-gradient(135deg, #3b1170, #1d0b3a);
  display: flex;
  align-items: center;
  padding: 18px 20px;
}
.promo-content { position: relative; z-index: 1; }
.promo-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--amber-light);
  border: 1px solid rgba(245, 196, 83, .4);
  border-radius: var(--r-pill);
  padding: 3px 9px;
  margin-bottom: 8px;
}
.promo-heading { font-size: 26px; font-weight: 800; letter-spacing: .02em; }
.promo-subheading { font-size: 11px; color: var(--amber-light); margin: 2px 0 4px; }
.promo-highlight {
  font-size: 30px;
  font-weight: 900;
  background: linear-gradient(180deg, #ffe9a8, #e0a83c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.promo-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.promo-pills span {
  font-size: 10px;
  color: var(--text-2);
  background: rgba(0, 0, 0, .35);
  border-radius: var(--r-pill);
  padding: 4px 9px;
}

/* Copy layered over the generated banner art. A left-to-right scrim keeps the
   text legible without dimming the artwork it sits on. */
.slide-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, rgba(10, 4, 24, .82) 20%, rgba(10, 4, 24, .45) 52%, transparent 76%);
  pointer-events: none;
}
.slide-overlay .promo-heading { font-size: 24px; font-weight: 800; text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.slide-overlay .promo-highlight { font-size: 27px; }

.games-section { padding: 0 16px; }
.game-cards-grid { display: grid; gap: 12px; }

.game-main-card {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform var(--t-fast) var(--ease-out);
}
.game-main-card:active { transform: scale(.985); }

.game-card-art {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #000;
}
.game-card-image-placeholder {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: radial-gradient(ellipse at 50% 40%, #2a1550, #08060f 70%);
}
.game-wordmark { width: 62%; max-width: 220px; }

.game-card-footer { padding: 14px 14px 16px; }
.game-card-title { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 12px; }
.btn-rule-intro {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 42px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.btn-rule-intro:active { transform: scale(.97); background: var(--surface-2); }
.btn-rule-intro .icon { width: 17px; height: 17px; }

/* ==========================================================================
   Wallet
   ========================================================================== */

.wallet-page { padding: 16px; }

.balance-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px 20px 26px;
  margin-bottom: 18px;
}
.balance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.balance-head-label { font-size: 14px; color: var(--text-dim); }
.balance-eye {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  color: var(--text-dim);
  transition: transform var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.balance-eye:active { transform: scale(.9); color: var(--text); }
.balance-eye .icon { width: 18px; height: 18px; }

.balance-split { display: flex; align-items: stretch; }
.balance-split-item { flex: 1; text-align: center; }
.balance-split-item + .balance-split-item { border-left: 1px solid var(--divider); }
.balance-split-label { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.balance-split-value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }

.balance-rule { height: 1px; background: var(--divider); margin: 20px 4px 16px; }

.balance-currency {
  text-align: center;
  font-size: 12px;
  letter-spacing: .22em;
  color: var(--text-mute);
  margin-bottom: 2px;
}
.balance-total {
  text-align: center;
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.balance-hidden { letter-spacing: .1em; }

.wallet-actions { display: flex; gap: 12px; margin-bottom: 6px; }
.wallet-actions .btn { flex: 1; }
.wallet-actions .icon { width: 21px; height: 21px; }

/* ==========================================================================
   Transactions / 资金明细
   ========================================================================== */

.tx-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  font-size: 13px;
  color: var(--text-dim);
}
.tx-group-total { font-variant-numeric: tabular-nums; }

.tx-list { background: var(--surface); }
.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  position: relative;
  transition: background var(--t-fast) var(--ease-out);
}
.tx-item:active { background: var(--surface-2); }
.tx-item + .tx-item::before {
  content: '';
  position: absolute;
  top: 0; left: 70px; right: 0;
  height: 1px;
  background: var(--divider);
}
.tx-info { flex: 1; min-width: 0; }
.tx-type { font-size: 15px; font-weight: 600; }
.tx-note { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.tx-right { text-align: right; }
/* The live app keeps amounts WHITE and colours only the status line. */
.tx-amount { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tx-status { font-size: 12px; margin-top: 3px; color: var(--text-dim); }
.tx-status.ok { color: var(--green); }
.tx-status.pending { color: var(--amber); }
.tx-status.fail { color: var(--red); }
.tx-more { text-align: center; padding: 18px 0; color: var(--blue-light); font-size: 14px; }

/* ==========================================================================
   Profile
   ========================================================================== */

.profile-container { padding: 8px 16px 0; }
.profile-user-card { text-align: center; padding: 16px 0 22px; }
.profile-avatar-wrap { position: relative; width: 104px; margin: 0 auto 14px; }
.profile-avatar {
  width: 104px; height: 104px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
}
.avatar-fallback {
  width: 104px; height: 104px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, var(--brand-violet), var(--brand-purple));
  color: #fff;
  font-size: 38px;
  font-weight: 700;
}
.profile-name-row {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  /* A <button> is shrink-to-fit even as a flex container, so the parent's
     text-align cannot centre it — auto margins do. */
  margin: 0 auto;
  font-size: 25px; font-weight: 800;
}
.profile-name-row .icon { width: 20px; height: 20px; color: var(--text-mute); }
.profile-uid { font-size: 14px; color: var(--text-dim); margin-top: 3px; font-variant-numeric: tabular-nums; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 15px 16px 17px;
}
.stat-title { font-size: 13px; color: var(--text-dim); }
.stat-value { font-size: 27px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
/* Oversized ghost glyph bleeding off the bottom-right corner. */
.stat-bg-icon { position: absolute; right: -6px; bottom: -10px; color: #fff; opacity: .045; }
.stat-bg-icon .icon { width: 62px; height: 62px; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 18px 8px 20px;
}
.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 10px 4px;
  border-radius: var(--r-md);
  transition: transform var(--t-fast) var(--ease-out);
}
.action-item:active { transform: scale(.93); }
.action-icon { color: var(--text); }
.action-icon .icon { width: 30px; height: 30px; stroke-width: 1.5; }
.action-label { font-size: 14px; color: var(--text); }

.profile-version { text-align: center; font-size: 13px; color: var(--text-mute); padding: 20px 0 8px; }

/* ==========================================================================
   Settings — grouped full-bleed list
   ========================================================================== */

.settings-group { margin-bottom: 10px; background: var(--surface); }
.settings-group-title {
  font-size: 13px;
  color: var(--text-dim);
  padding: 18px 16px 8px;
  background: var(--bg);
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px 16px;
  position: relative;
  transition: background var(--t-fast) var(--ease-out);
}
.settings-item:active { background: var(--surface-2); }
.settings-item + .settings-item::before {
  content: '';
  position: absolute;
  top: 0; left: 16px; right: 0;
  height: 1px;
  background: var(--divider);
}
/* The label is the row's first span; everything else sits on the right. */
.settings-item > span:first-child { flex: 1; font-size: 16px; }
.settings-item-label { flex: 1; font-size: 16px; }
.settings-item-value { font-size: 14px; color: var(--text-dim); }
.menu-right {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--text-dim);
  flex: none;
}
.menu-right .icon { color: var(--text-mute); }
.settings-item .chev { color: var(--text-mute); }
.settings-item.is-danger > span:first-child,
.settings-item.is-danger .settings-item-label { color: var(--red); }
.settings-hint { font-size: 13px; color: var(--text-dim); line-height: 1.6; padding: 12px 16px 20px; }

.subview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 17px;
  border-bottom: 1px solid var(--divider);
}
.subview-back {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text-2);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.subview-back:active { transform: scale(.9); background: var(--surface-2); }

.status-card {
  display: flex; align-items: center; gap: 12px;
  margin: 16px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: rgba(52, 211, 153, .1);
  border: 1px solid rgba(52, 211, 153, .25);
}
.status-card.is-warn { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .28); }
.status-card .icon { width: 26px; height: 26px; color: var(--green); }
.status-card.is-warn .icon { color: var(--amber); }
.status-card-title { font-size: 16px; font-weight: 700; }
.status-card-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }

/* ==========================================================================
   Referral / 我的推广
   ========================================================================== */

.referral-page { padding: 16px; }

.invite-card {
  text-align: center;
  padding: 24px 20px 20px;
  margin-bottom: 12px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(245, 196, 83, .22);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(124, 58, 237, .28), transparent 65%),
    var(--surface);
}
.invite-label { font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }
.invite-code {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: .1em;
  margin-bottom: 18px;
  background: linear-gradient(180deg, #ffe9a8, #d9a441);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.card-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  font-size: 15px;
  color: var(--text-2);
  border-bottom: 1px solid var(--divider);
}
.kv-row:last-child { border-bottom: none; }
.kv-row b { font-variant-numeric: tabular-nums; color: var(--text); }
.kv-accent { color: var(--amber) !important; }

.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 4px 0 14px;
}
.date-nav-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  color: var(--text-2);
  transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out);
}
.date-nav-btn:active { transform: scale(.9); }
.date-nav-btn:disabled { opacity: .3; pointer-events: none; }
.date-nav-label { font-size: 14px; color: var(--text-2); min-width: 130px; text-align: center; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Leaderboard
   ========================================================================== */

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  position: relative;
}
.rank-row + .rank-row::before {
  content: '';
  position: absolute;
  top: 0; left: 16px; right: 16px;
  height: 1px;
  background: var(--divider);
}
.rank {
  width: 30px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-mute);
  flex: none;
}
.rank-medal { width: 30px; height: 34px; flex: none; }
.rank-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  flex: none;
}
.rank-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name.is-hidden { color: var(--text-mute); font-weight: 500; }
.rank-score { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-threshold {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 14px 16px;
  background: var(--surface);
  margin-bottom: 2px;
}
.lb-threshold[hidden] { display: none; }

/* Your own row pinned under the list. */
.my-rank-bar { margin-top: 10px; background: var(--surface); }
.rank-row.is-me { background: rgba(59, 130, 246, .09); }
.rank-row.is-me .rank-name { color: var(--blue-light); }

/* ==========================================================================
   Daily rewards
   ========================================================================== */

.rewards-tab-body { padding: 14px 16px 0; }

.rewards-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.reward-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.reward-title { font-size: 18px; font-weight: 700; }
.reward-cond { font-size: 13px; color: var(--text-dim); margin-left: 6px; font-weight: 400; }
.reward-amount { font-size: 19px; font-weight: 800; color: var(--amber); font-variant-numeric: tabular-nums; white-space: nowrap; }
.reward-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0 11px; }
.badge-chip {
  padding: 7px 15px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 14px;
}
.badge-chip.collected { background: rgba(245, 158, 11, .16); color: var(--amber); }
.reward-hint { display: flex; align-items: flex-start; gap: 7px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.reward-hint .icon { width: 15px; height: 15px; margin-top: 2px; color: var(--amber); }
.remaining-tag { font-size: 13px; color: var(--text-mute); margin-top: 8px; }

/* Banker milestone stepper. */
.milestone-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.timeline-box { position: relative; }
.timeline-row { display: flex; align-items: center; gap: 14px; padding: 7px 0; position: relative; }
.timeline-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--surface-3);
  flex: none;
  position: relative;
  z-index: 1;
  background: var(--surface);
  transition: border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}
/* Vertical connector between dots. */
.timeline-row + .timeline-row .timeline-dot::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  width: 2px;
  height: 22px;
  background: var(--surface-3);
}
.timeline-row.current .timeline-dot {
  border-color: #22d3ee;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .16);
}
.timeline-row.reached .timeline-dot { border-color: var(--amber); background: var(--amber); }
.timeline-label { flex: 1; font-size: 16px; font-weight: 600; }
.timeline-row.current .timeline-label { color: #22d3ee; }
.timeline-reward { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline-row.current .timeline-reward { color: #22d3ee; }
.timeline-hint { display: flex; align-items: flex-start; gap: 7px; font-size: 13px; color: var(--text-dim); margin-top: 14px; }
.timeline-hint .icon { width: 15px; height: 15px; margin-top: 2px; color: var(--amber); }

/* Weekly reward rows (特别奖励 tab). Named apart from .rank-row so the
   leaderboard's row styling cannot bleed into them. */
.weekly-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--divider);
}
.weekly-row:last-child { border-bottom: none; }
.weekly-row strong { color: var(--amber); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ==========================================================================
   Rules / 玩法介绍
   ========================================================================== */

.rules-page-container { padding-bottom: 96px; }
/* `height: auto` is load-bearing: the <img> carries width/height attributes for
   layout stability, and without it both dimensions are definite so aspect-ratio
   is ignored and the image renders at its full intrinsic 900px height. */
.rules-hero { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; background: #000; }
.rules-content-body { padding: 20px 16px 0; }
.rules-section { margin-bottom: 26px; }
.rules-section h3 { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.rules-section p { font-size: 15px; line-height: 1.72; color: var(--text-2); }
.rules-sub { font-size: 15px; line-height: 1.72; color: var(--text-2); padding-left: 14px; margin-top: 8px; }
.rules-sub b { color: var(--text); }
.rules-example-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
}
.rules-bottom-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 80;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(28, 29, 34, 0), var(--bg) 32%);
}
.rules-bottom-bar .btn { max-width: 520px; margin: 0 auto; }

/* ==========================================================================
   Chat list
   ========================================================================== */

.chat-list-items { background: var(--surface); }
.chat-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  position: relative;
  transition: background var(--t-fast) var(--ease-out);
}
.chat-item:active { background: var(--surface-2); }
.chat-item + .chat-item::before {
  content: '';
  position: absolute;
  top: 0; left: 74px; right: 0;
  height: 1px;
  background: var(--divider);
}
.chat-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  flex: none;
}
.chat-avatar.is-support { background: #22a06b; color: #fff; display: flex; align-items: center; justify-content: center; }
.chat-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.chat-name-row { display: flex; align-items: center; gap: 5px; }
.chat-name { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-verified { width: 15px; height: 15px; flex: none; }
.chat-preview { font-size: 14px; color: var(--text-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-time { font-size: 12px; color: var(--text-mute); flex: none; align-self: flex-start; margin-top: 3px; }
.chat-unread {
  min-width: 20px; height: 20px;
  border-radius: var(--r-pill);
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px;
}
