/* ============================================================
 * 一掷千金模拟器（肉鸽版）· 样式
 * 主题：深海赌场 —— 深藏青底（#070b18）+ 赌场金（#f6d365）+ 冷蓝（#7ec8e3）
 * 组件命名与布局体系沿用《练蛊模拟器》（topbar / tabbar / view / page-head /
 *   btn / tabs / lb-row / ach-item / mask / set-card），只换配色与新增对局组件。
 * ⚠ 背景是纯色 + fixed 网格（长列表滚动不出现上下分层，B站 WebView 不支持
 *   background-attachment: fixed，所以用 fixed 伪元素画）。
 * ============================================================ */
[hidden] { display: none !important; }

:root {
  --bg:          #070b18;
  --bg-deep:     #04060f;
  --panel:       #101a33;
  --panel-2:     #16244a;
  --panel-3:     #1d2f5c;
  --line:        #2f5fa8;
  --line-soft:   #1d3a68;
  --gold:        #f6d365;
  --gold-dim:    #8a6f22;
  --gold-bright: #ffe9a8;
  --teal:        #7ec8e3;
  --teal-dim:    #35708a;
  --danger:      #a8302b;
  --danger-text: #ff9a9a;
  --ok:          #7fdc9a;
  --text:        #eef4ff;
  --text-dim:    #a9bcd8;
  --text-mute:   #6c84a8;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, "DejaVu Sans Mono", monospace;

  --a-verylow:  #7ec8e3;
  --a-low:      #8fe0f0;
  --a-medium:   #f6d365;
  --a-high:     #fda085;
  --a-veryhigh: #ff6b6b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100%;
  width: 100%; max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
#app {
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  background: var(--bg); position: relative; overflow-x: hidden;
}
img, canvas, video, table { max-width: 100%; }
.log-item, .about-text, .mask-info, .lb-name, .settle-note, .rr-desc {
  overflow-wrap: anywhere; word-break: break-word;
}
body::before {
  content: '';
  position: fixed; top: 0; left: 50%;
  width: 480px; max-width: 100%; height: 100%;
  transform: translateX(-50%);
  background:
    radial-gradient(90% 55% at 50% 0%, rgba(246,211,101,.10), transparent 62%),
    radial-gradient(120% 70% at 50% 108%, rgba(126,200,227,.10), transparent 66%),
    repeating-linear-gradient(0deg, rgba(126,200,227,.035) 0 1px, transparent 1px 36px),
    repeating-linear-gradient(90deg, rgba(126,200,227,.035) 0 1px, transparent 1px 36px);
  pointer-events: none; z-index: 0;
}

/* ============================================================
 * 自定义滚动条（全站统一）：细 6px、金色渐变滑块、深色轨道
 *   兼容 WebKit（B站 WebView / Chrome / Safari）与 Firefox（scrollbar-width/color）
 * ============================================================ */
* { scrollbar-width: thin; scrollbar-color: var(--gold-dim) rgba(255,255,255,.05); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,.04); border-radius: 3px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:active { background: var(--gold-bright); }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- 页面 ---------- */
.view {
  position: relative; z-index: 1;
  display: none; flex-direction: column; align-items: center;
  min-height: calc(100vh - 52px);
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
}
.view.on { display: flex; }
/* 带底栏的页面都要给 tabbar 留位置（结算页也显示底栏） */
/* 首页整块上下居中（内容超出时可安全滚动） */
#view-home { justify-content: center; }
@supports (justify-content: safe center) { #view-home { justify-content: safe center; } }

#view-home, #view-rank, #view-ach, #view-hl, #view-about, #view-settle {
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
/* ⚠ 宽度屏障只作用于内部容器：**不能把 #app 自己也设成 max-width:100%**，
 *   否则会盖掉上面的 `max-width:480px`（同特异性、后写的赢），电脑上会铺满整屏。 */
#app { width: 100%; }
.view, .home-hero, .page-head { width: 100%; max-width: 100%; }
.home-title, .game-title, .page-title, .home-count, .home-tianli {
  max-width: 100%; overflow: hidden;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 14px;
  background: rgba(7,11,24,.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: baseline; gap: 2px; font-weight: 900; }
.brand .b1 { color: var(--gold); font-size: 19px; }
.brand .b2 { color: #f0e6cf; font-size: 19px; }
.brand .b3 { color: var(--text-mute); font-size: 9px; margin-left: 6px; letter-spacing: .5px; }
.top-btn {
  margin-left: auto; border: 1px solid var(--line-soft); background: var(--panel);
  color: var(--text-dim); border-radius: 999px; padding: 6px 12px;
  font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.top-btn:active { color: var(--gold-bright); border-color: var(--gold); }
.top-btn.off { opacity: .5; }
body.in-game .topbar { display: none; }
body.in-game .view { min-height: 100vh; }

/* ---------- 底栏 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 45;
  display: flex; padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  background: rgba(7,11,24,.95);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-soft);
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; color: var(--text-mute);
  font-size: 10.5px; padding: 4px 0; font-family: inherit; cursor: pointer;
}
.tabbar .tab .ti { font-size: 16px; opacity: .8; }
.tabbar .tab.on { color: var(--gold); }
body.hide-tabbar .tabbar { display: none; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--text); border-radius: 12px; padding: 10px 17px;
  font-size: 14.5px; cursor: pointer; user-select: none;
  transition: transform .1s, filter .15s; white-space: nowrap; font-family: inherit;
}
.btn:active { transform: scale(.97); filter: brightness(1.15); }
.btn-primary {
  background: linear-gradient(180deg, #ffe9a8, #f6d365);
  border-color: var(--gold-bright); color: #2a1d00; font-weight: 700;
}
.btn-big { width: 100%; padding: 12px 14px; font-size: 14.5px; border-radius: 13px; }
.btn-danger { border-color: var(--danger); color: var(--danger-text); }
.btn.gray, .btn:disabled { opacity: .45; cursor: default; }
.btn-pause {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  width: 38px; height: 38px; border-radius: 50%; font-size: 15px; cursor: pointer; flex: 0 0 auto;
}
/* 透视镜用完后变暗（updatePeekBtn 会加 off） */
.btn-pause.off { opacity: .38; }
.btn-pill {
  border: 1px solid var(--line-soft); background: rgba(255,255,255,.04); color: var(--text-dim);
  border-radius: 999px; padding: 6px 14px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.btn-pill:active { color: var(--gold-bright); border-color: var(--gold); }
.btn-mini {
  border: 1px solid var(--line-soft); background: rgba(255,255,255,.05); color: var(--text-dim);
  border-radius: 8px; padding: 4px 9px; font-size: 11.5px; cursor: pointer; font-family: inherit;
}

/* ---------- 首页 ---------- */
.home-hero { text-align: center; margin-top: 4px; }
.home-title {
  margin: 0; font-size: 30px; font-weight: 900; letter-spacing: 3px;
  background: linear-gradient(135deg, #ffe9a8, #f6d365 45%, #fda085);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub-row { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; }
.home-sub { font-size: 12px; color: var(--text-mute); letter-spacing: .5px; }
.btn-share {
  border: 1px solid var(--line-soft); background: rgba(255,255,255,.04); color: var(--text-dim);
  width: 24px; height: 24px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.home-count {
  width: 100%; margin-top: 12px; text-align: center;
  font-size: 12.5px; color: var(--text-dim);
  background: rgba(255,255,255,.04); border: 1px solid var(--line-soft);
  border-radius: 999px; padding: 7px 10px;
}
.home-count b { color: var(--teal); font-size: 1.05em; }

.home-lv {
  width: 100%; margin-top: 12px; padding: 13px 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-soft); border-radius: 16px;
}
.lv-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.lv-name { color: var(--teal); font-weight: 700; }
.lv-lv { color: var(--gold-bright); font-size: 14px; }
.lv-head .lv-exp-line { margin-left: auto; font-size: 11.5px; color: var(--text-mute); }
.lv-bar {
  margin-top: 8px; height: 7px; border-radius: 999px;
  background: rgba(255,255,255,.08); overflow: hidden;
}
.lv-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width .25s;
}
.lv-bonus-line { margin-top: 7px; text-align: center; }
.lv-bonus { font-size: 12px; color: var(--text-dim); }
.lv-bonus b { color: var(--gold-bright); }
.home-primary { width: 100%; margin-top: 14px; }
.home-primary .btn-big { font-size: 17px; padding: 14px; letter-spacing: 2px; }
/* 继续游戏（有断点时才出现） */
.home-continue { width: 100%; margin-top: 8px; }
.btn-continue {
  width: 100%; font-size: 15px; padding: 12px; letter-spacing: 1px;
  color: var(--gold-bright);
  border-color: rgba(246,211,101,.55);
  background: linear-gradient(180deg, rgba(246,211,101,.16), rgba(246,211,101,.04));
}
.btn-continue b { color: var(--gold-bright); }
.btn-follow {
  width: 100%; margin-top: 10px; font-size: 13px; padding: 10px;
  border-color: rgba(246,211,101,.45); color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(246,211,101,.14), rgba(246,211,101,.05));
}
.home-tianli {
  width: 100%; margin-top: 10px; text-align: center;
  font-size: 11.5px; color: var(--text-dim);
  background: rgba(255,255,255,.03); border: 1px solid var(--line-soft);
  border-radius: 999px; padding: 6px 10px;
}
.home-tianli b { color: var(--gold-bright); }

/* ---------- 子页 ---------- */
.page-view { align-items: stretch; }
.page-head {
  display: flex; align-items: center; justify-content: center;
  position: relative; margin-bottom: 14px; min-height: 34px;
}
.page-title {
  margin: 0; font-size: 18px; font-weight: 800; letter-spacing: 1px;
  color: var(--gold-bright); text-align: center;
}
.btn-close {
  position: absolute; right: 0; top: 0;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line-soft); background: rgba(255,255,255,.05);
  color: var(--text-dim); font-size: 15px; cursor: pointer;
}
.btn-close:active { transform: scale(.92); color: var(--gold-bright); border-color: var(--gold); }

/* ---------- tabs ---------- */
.tabs { width: 100%; display: flex; gap: 6px; margin-bottom: 8px; }
.tabs-wrap { flex-wrap: wrap; }
.tabs-small .tab { font-size: 12px; padding: 6px 4px; }
.tab {
  flex: 1 1 0; min-width: 0;
  border: 1px solid var(--line-soft); background: rgba(255,255,255,.04);
  color: var(--text-mute); border-radius: 10px; padding: 8px 4px;
  font-size: 13px; cursor: pointer; font-family: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tab.active { background: rgba(246,211,101,.16); color: var(--gold-bright); border-color: var(--gold); }
/* 5 个榜位：每行 3 个、**等分占满整行**（最后一行 2 个会各自撑到一半，不留空档） */
#rank-board { flex-wrap: wrap; }
#rank-board .tab {
  flex: 1 1 calc((100% - 12px) / 3);
  min-width: 0; font-size: 12px; padding: 7px 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 排行榜 ---------- */
.lb-note { width: 100%; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; text-align: center; }
.rank-fate-note { width: 100%; font-size: 12px; color: var(--gold); margin-bottom: 8px; text-align: center; }
.lb-body {
  width: 100%; display: flex; flex-direction: column; gap: 5px;
  /* ⚠ 不留白：撑满剩余高度（原先 max-height:62vh 会在长屏上留一大块黑） */
  flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto;
}
.lb-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: 10px;
  background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.04);
  font-size: 13px;
}
.lb-row.me { border-color: var(--gold); background: rgba(246,211,101,.10); }
.lb-rank { flex: 0 0 30px; text-align: center; font-weight: 800; color: var(--text-mute); }
.lb-rank.top { color: var(--gold-bright); }
.lb-rank.r1 { color: #ffe9a8; } .lb-rank.r2 { color: #dfe6f0; } .lb-rank.r3 { color: #e0b64a; }
.lb-user { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.lb-avatar { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto; background: rgba(255,255,255,.1); }
.lb-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-time { font-size: 11px; color: var(--text-mute); white-space: nowrap; }
.lb-score { margin-left: auto; color: var(--gold-bright); font-weight: 700; white-space: nowrap; }
.lb-tip {
  text-align: center; color: var(--text-mute); font-size: 13px; padding: 22px 0;
  /* 空态垂直居中：列表区撑满后，提示落在中间而不是顶部留一大块黑 */
  margin: auto 0;
}
.lb-stats { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.lb-stat { background: rgba(255,255,255,.04); border-radius: 12px; padding: 9px 6px; text-align: center; }
.lb-stat .val { font-size: 19px; font-weight: 900; color: var(--gold-bright); }
.lb-stat .label { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

/* ---------- 成就 ---------- */
.ach-total {
  width: 100%; text-align: center; font-size: 13px; color: var(--gold-bright);
  background: rgba(246,211,101,.10); border: 1px solid rgba(246,211,101,.28);
  border-radius: 12px; padding: 10px; margin-bottom: 12px;
}
.ach-list {
  width: 100%; display: flex; flex-direction: column; gap: 6px;
  flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; padding-right: 2px;
}
.ach-item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.05);
}
.ach-line1 { display: flex; align-items: center; gap: 10px; }
.ach-bar {
  height: 5px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.08);
}
.ach-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width .25s;
}
.ach-item.done .ach-bar-fill { background: linear-gradient(90deg, #7fdc9a, #b7f5c6); }
.ach-nums {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.ach-item.done .ach-nums { color: var(--ok); }
.ach-item.done { background: rgba(127,220,154,.08); border-color: rgba(127,220,154,.28); }
.ach-name { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 600; }
.ach-item.done .ach-name { color: var(--ok); }
.ach-item.todo .ach-name { color: #8b9ab0; }
.ach-bonus { font-size: 12px; white-space: nowrap; }
.ach-item.done .ach-bonus { color: var(--ok); }
.ach-item.todo .ach-bonus { color: #5c6882; }

/* ---------- 高光 ---------- */
.hl-note { width: 100%; font-size: 12px; color: var(--text-dim); margin-bottom: 10px; text-align: center; }
.hl-list {
  width: 100%; display: flex; flex-direction: column; gap: 8px;
  flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto;
}
.hl-item {
  padding: 11px 12px; border-radius: 12px;
  background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.05);
  cursor: pointer;
}
.hl-item:active { filter: brightness(1.15); }
.hl-top { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.hl-top b { color: var(--gold-bright); }
.hl-end { margin-left: auto; font-size: 11.5px; color: var(--text-mute); }
.hl-mid { margin-top: 5px; font-size: 12px; color: var(--text-dim); }
.hl-mid b { color: var(--text); }
.hl-buff {
  margin-top: 6px; font-size: 11.5px; color: var(--teal); line-height: 1.55;
  overflow-wrap: anywhere; word-break: break-word;
}
.hl-img-box { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px; }
.hl-img { max-width: 88vw; max-height: 68vh; border-radius: 10px; }
.hl-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hl-toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 320; background: rgba(16,26,51,.96); color: var(--text);
  padding: 9px 18px; border-radius: 999px; font-size: 13px;
  border: 1px solid rgba(246,211,101,.3); box-shadow: 0 8px 30px rgba(0,0,0,.5);
}

/* ---------- 设置 / 说明 ---------- */
.about-body { width: 100%; }
.about-text {
  font-size: 13px; line-height: 1.95; color: var(--text-dim);
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.05);
  border-radius: 14px; padding: 14px 15px;
}
.about-text b { color: var(--gold-bright); }

/* ---------- 顶栏提示条 ---------- */
.ach-toast {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 330; max-width: 92vw;
  background: rgba(16,26,51,.97); color: var(--gold-bright);
  border: 1px solid rgba(246,211,101,.45); border-radius: 999px;
  padding: 9px 18px; font-size: 13px; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
}

/* ============================================================
 * 对局页
 * ============================================================ */
.game-top { width: 100%; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.game-title {
  flex: 1 1 auto; min-width: 0; margin: 0;
  font-size: 18px; font-weight: 800; color: var(--gold-bright);
  white-space: nowrap; overflow: hidden;
}
/* 奖励关：标题整行变金色（含描边光） */
.game-title.bonus {
  color: #ffd54a;
  text-shadow: 0 0 10px rgba(255,213,74,.55), 0 0 22px rgba(255,190,0,.28);
  letter-spacing: .5px;
}
.hud {
  width: 100%; padding: 10px 12px; border-radius: 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-soft); margin-bottom: 10px;
}
.hud-row1 { display: flex; gap: 6px; }
.hud-chip {
  flex: 1 1 0; min-width: 0; text-align: center;
  background: rgba(255,255,255,.05); border-radius: 9px; padding: 6px 4px;
  font-size: 11px; color: var(--text-mute); white-space: nowrap;
}
.hud-chip b { display: block; margin-top: 2px; font-size: 14px; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.hud-chip.ok b { color: var(--ok); }
.hud-row2 {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 8px; font-size: 11.5px; color: var(--text-mute);
}
.hud-row2 b { color: var(--text); }
.hud .lv-bar { margin-top: 8px; }

/* 银行家 */
.banker-area {
  width: 100%; text-align: center; padding: 10px 12px 12px; margin-bottom: 10px;
  background: linear-gradient(135deg, rgba(246,211,101,.10), rgba(246,211,101,.03));
  border: 1px solid rgba(246,211,101,.20); border-radius: 14px;
}
.banker-area .label { font-size: 12px; color: var(--gold); letter-spacing: 1px; }
.banker-area .offer {
  display: none; margin: 3px 0 6px;
  font-size: 34px; font-weight: 900; color: #fff;
  text-shadow: 0 0 26px rgba(246,211,101,.35);
  font-variant-numeric: tabular-nums;
}
.banker-area .offer.show { display: block; animation: offerPop .35s ease; }
@keyframes offerPop {
  0% { transform: scale(.6); opacity: 0; }
  65% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.banker-area .msg { font-size: 13px; color: var(--text-dim); min-height: 19px; line-height: 1.4; }
.btn-group { display: none; gap: 10px; justify-content: center; margin-top: 8px; }
.btn-group.show { display: flex; }
.btn-deal, .btn-nodeal {
  flex: 1 1 0; max-width: 150px; padding: 10px 8px; border-radius: 999px;
  border: none; font-size: 15px; font-weight: 800; letter-spacing: 1px;
  cursor: pointer; font-family: inherit; transition: transform .12s;
}
.btn-deal { background: linear-gradient(135deg, #ffe9a8, #f6d365); color: #2a1d00; }
.btn-nodeal { background: rgba(255,255,255,.08); color: var(--text); border: 1px solid rgba(255,255,255,.18); }
.btn-deal:active, .btn-nodeal:active { transform: scale(.96); }

/* 箱子 */
.box-grid {
  width: 100%; display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px; margin-bottom: 10px;
}
.box {
  width: calc((100% - 36px) / 7); aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 10px; cursor: pointer; user-select: none;
  background: linear-gradient(145deg, #1b3363, #12224a);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 3px 10px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .15s, opacity .15s, box-shadow .15s;
  overflow: hidden; padding: 2px;
}
.box:active:not(.opened):not(.disabled) { transform: scale(.93); }
.box .num { font-size: 14px; font-weight: 800; line-height: 1.1; pointer-events: none; }
.box .icon { font-size: 12px; margin-top: 1px; opacity: .45; pointer-events: none; }
.box.selected {
  background: linear-gradient(145deg, #ffe9a8, #f6d365);
  border-color: #fff; color: #2a1d00;
  box-shadow: 0 0 18px rgba(246,211,101,.45);
  animation: boxPulse 2s infinite;
}
.box.selected .icon { opacity: .8; }
@keyframes boxPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(246,211,101,.3); }
  50% { box-shadow: 0 0 24px rgba(246,211,101,.6); }
}
.box.opened {
  background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.06);
  cursor: default; opacity: .5;
}
.box.opened .num { font-size: 10px; color: var(--text-mute); }
.box.opened .amount-label { font-size: 9.5px; font-weight: 800; margin-top: 1px; pointer-events: none; white-space: nowrap; }
.box .amount-label.a-verylow { color: var(--a-verylow); }
.box .amount-label.a-low { color: var(--a-low); }
.box .amount-label.a-medium { color: var(--a-medium); }
.box .amount-label.a-high { color: var(--a-high); }
.box .amount-label.a-veryhigh { color: var(--a-veryhigh); }
.box.disabled { cursor: default; opacity: .42; }
.box.peeked {
  border-color: #4af; box-shadow: 0 0 14px rgba(68,170,255,.55);
  background: linear-gradient(145deg, #134a7a, #0d3557);
  animation: peekPulse 1.2s infinite;
}
@keyframes peekPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(68,170,255,.35); }
  50% { box-shadow: 0 0 22px rgba(68,170,255,.7); }
}
.box.peeked .peek-amount { font-size: 9.5px; font-weight: 800; color: #9fdcff; margin-top: 1px; }
.box.peek-ready { border-color: rgba(68,170,255,.55); animation: peekPulse 1.2s infinite; cursor: crosshair; }
.box.peek-block { border-color: rgba(255,107,107,.45); opacity: .5; animation: none; }

/* 底部信息行 */
.info-row {
  width: 100%; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px;
}
.info-box {
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.05);
  border-radius: 10px; padding: 7px 10px;
}
.info-box .title { font-size: 10.5px; color: var(--text-mute); margin-bottom: 5px; letter-spacing: .5px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  background: rgba(255,255,255,.06); color: var(--text-dim);
}
.chip.a-verylow { background: rgba(126,200,227,.14); color: var(--a-verylow); }
.chip.a-low { background: rgba(143,224,240,.18); color: var(--a-low); }
.chip.a-medium { background: rgba(246,211,101,.18); color: var(--a-medium); }
.chip.a-high { background: rgba(253,160,133,.18); color: var(--a-high); }
.chip.a-veryhigh { background: rgba(255,107,107,.18); color: var(--a-veryhigh); }
.rem-list { display: flex; flex-wrap: wrap; gap: 4px; max-height: 74px; overflow-y: auto; }
.rem-item { font-size: 10.5px; color: var(--text-dim); background: rgba(255,255,255,.045); border-radius: 8px; padding: 1px 7px; }
.rem-item.a-verylow { color: var(--a-verylow); }
.rem-item.a-low { color: var(--a-low); }
.rem-item.a-medium { color: var(--a-medium); }
.rem-item.a-high { color: var(--a-high); }
.rem-item.a-veryhigh { color: var(--a-veryhigh); }

/* 已持有 buff（放在 HUD 之上，一眼能看到本局带走了什么） */
.buff-row {
  width: 100%; display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px;
}
.buff-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid rgba(246,211,101,.35); background: rgba(246,211,101,.10);
  color: var(--gold-bright); border-radius: 999px; padding: 3px 9px;
  font-size: 11px; cursor: pointer; font-family: inherit;
}
.buff-chip .n { font-size: 10px; color: var(--gold); }
/* 固定第一格：收益总加成（不是按钮，不能点） */
.buff-chip.buff-total {
  cursor: default; font-weight: 700;
  color: #1b1405; border-color: rgba(255,226,150,.9);
  background: linear-gradient(180deg, #ffe28f, #e8b93c);
}
.buff-chip.buff-total b { color: #1b1405; font-weight: 900; }
.buff-empty { font-size: 11px; color: var(--text-mute); }

/* ============================================================
 * 弹层通用
 * ============================================================ */
.mask {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2,5,12,.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 18px;
}
/* 增益三选一：只压 50% 遮罩，能看见底下的牌桌 */
#buff-mask { background: rgba(2,5,12,.5); backdrop-filter: none; -webkit-backdrop-filter: none; }
/* 回顾本局同理：半透明遮罩，不把牌桌糊死 */
#review-mask { background: rgba(2,5,12,.5); backdrop-filter: none; -webkit-backdrop-filter: none; }
#review-mask .mask-box { background: linear-gradient(180deg, rgba(20,32,58,.94), rgba(11,18,34,.94)); }

/* 所有弹层统一：右上角 ✕（不再用文字「关闭」按钮） */
.mask-x {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; padding: 0; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-soft); border-radius: 50%;
  background: rgba(255,255,255,.06); color: var(--text-dim);
  font-size: 13px; font-family: inherit; cursor: pointer;
}
.mask-x:active { color: var(--gold-bright); border-color: var(--gold); }
#buff-mask .mask-x { background: rgba(255,255,255,.10); }
#buff-mask .mask-box { background: linear-gradient(180deg, rgba(20,32,58,.94), rgba(11,18,34,.94)); }

/* 弹窗里的「已有增益」摘要 */
.buff-owned {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin: -4px 0 10px; padding: 7px 9px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(246,211,101,.14);
}
.buff-owned .bo-label { font-size: 11px; color: var(--text-mute); margin-right: 2px; }
.buff-owned .bo-chip {
  font-size: 11px; color: var(--gold-bright); background: rgba(246,211,101,.10);
  border: 1px solid rgba(246,211,101,.28); border-radius: 999px; padding: 2px 8px;
}
.buff-owned .bo-empty { font-size: 11px; color: var(--text-mute); }

.mask-box {
  position: relative;
  width: 360px; max-width: 94vw; max-height: 88vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid rgba(255,255,255,.08); border-radius: 20px;
  padding: 18px 18px 16px; box-shadow: 0 18px 60px rgba(0,0,0,.6);
}
.mask-title {
  text-align: center; font-size: 17px; font-weight: 800; color: var(--gold-bright);
  margin-bottom: 10px; letter-spacing: 1px;
}
.mask-info { text-align: center; font-size: 13px; color: var(--text-dim); line-height: 1.75; margin-bottom: 12px; }
.mask-info b { color: var(--gold-bright); }
.mask-warn { color: var(--danger-text); }
.mask-box .btn { width: 100%; margin-top: 8px; }
.share-qr { display: block; width: 180px; height: 180px; margin: 0 auto 10px; border-radius: 10px; background: #fff; padding: 6px; }
.share-link {
  font-size: 11.5px; color: var(--text-mute); background: rgba(0,0,0,.3);
  border-radius: 8px; padding: 8px 10px; word-break: break-all; margin-bottom: 8px;
}
.follow-rows { display: flex; flex-direction: column; gap: 8px; }
.follow-action { display: flex; align-items: center; font-size: 13px; text-align: left; }
.fb-state { margin-left: auto; font-size: 11.5px; }
.fb-state.done { color: var(--ok); }
.fb-state.todo { color: var(--text-mute); }
.fb-total { text-align: center; color: var(--gold); margin-top: 12px; font-size: 13px; }
.confirm-btns { display: flex; gap: 8px; }
.confirm-btns .btn { flex: 1 1 0; width: auto; }
.pause-box .btn { margin-top: 8px; }

/* ---------- 本局回顾 ---------- */
.review-box { width: 350px; }
.review-log {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 58vh; overflow-y: auto; margin-bottom: 12px;
}
.review-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-dim);
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.05);
  border-radius: 8px; padding: 7px 10px; white-space: nowrap;
}
.review-item b { color: var(--text); }
.review-item .ok { color: var(--ok); font-weight: 700; }
.review-item .bad { color: var(--danger-text); font-weight: 700; }
/* 回顾里每轮都必须能看到「自己那只箱子」到底是多少 */
.review-box-val {
  font-size: 11.5px; color: var(--text-mute); padding: 0 10px 6px;
  margin-top: -4px; text-align: left;
}
.review-box-val b { font-weight: 800; }
.review-box-val .gold { color: var(--gold-bright); }

/* ---------- 本轮结算弹层 ---------- */
.rr-card { text-align: center; }
.rr-title { font-size: 19px; font-weight: 900; color: var(--gold-bright); letter-spacing: 1px; }
.rr-row b.gold { color: var(--gold-bright); }
.rr-amount {
  margin: 8px 0 4px; font-size: 36px; font-weight: 900;
  background: linear-gradient(135deg, #ffe9a8, #f6d365, #fda085);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}
.rr-rows { margin: 10px 0 4px; }
.rr-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: var(--text-mute);
  padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.06);
}
.rr-row:last-child { border-bottom: none; }
.rr-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.rr-row b.ok { color: var(--ok); }
.rr-row b.bad { color: var(--danger-text); }
.rr-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.7; margin: 8px 0 12px; }
.rr-btns { display: flex; gap: 8px; }
.rr-btns .btn { flex: 1 1 0; margin-top: 0; }

/* ---------- buff 三选一 ---------- */
.buff-cards { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.buff-card {
  text-align: left; border-radius: 14px; padding: 12px 13px; cursor: pointer;
  background: rgba(255,255,255,.045); border: 1px solid rgba(246,211,101,.28);
  transition: transform .12s, filter .15s; font-family: inherit; color: var(--text);
}
.buff-card:active { transform: scale(.98); filter: brightness(1.15); }
.buff-card .bc-top { display: flex; align-items: center; gap: 8px; }
.buff-card .bc-name { font-size: 15px; font-weight: 800; color: var(--gold-bright); }
.buff-card .bc-kind {
  margin-left: auto; font-size: 10.5px; color: var(--teal);
  border: 1px solid rgba(126,200,227,.35); border-radius: 999px; padding: 1px 8px;
}
.buff-card .bc-desc { margin-top: 6px; font-size: 12.5px; color: var(--text-dim); line-height: 1.6; }

/* ============================================================
 * 一局结算
 * ============================================================ */
.settle-box {
  width: 100%; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid rgba(255,255,255,.07); border-radius: 18px;
  padding: 18px 15px;
}
.settle-title {
  text-align: center; font-size: 22px; font-weight: 900; letter-spacing: 2px;
  color: var(--gold-bright);
}
.settle-title.fail { color: var(--danger-text); }
.settle-rows { display: flex; flex-direction: column; }
.s-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 2px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13px;
}
.s-row:last-child { border-bottom: none; }
.s-row span { color: var(--text-mute); }
.s-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.s-row b.gold { color: var(--gold-bright); }
.s-row b.ok { color: var(--ok); }
.settle-note { font-size: 12.5px; color: var(--gold); text-align: center; line-height: 1.7; }
.settle-rank {
  text-align: center; font-size: 12.5px; color: var(--text-dim);
  background: rgba(255,255,255,.04); border-radius: 10px; padding: 9px;
}
.settle-btns { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; }
.settle-btns .btn-big { padding: 11px 6px; font-size: 14px; border-radius: 11px; }
.qr-area { margin-top: 4px; text-align: center; }
.qr-text { font-size: 12px; color: var(--text-mute); margin-bottom: 6px; }
.qr-img { width: 140px; height: 140px; border-radius: 10px; background: #fff; padding: 6px; }

/* ============================================================
 * 窄屏
 * ============================================================ */
@media (max-width: 420px) {
  .view { padding: 14px 12px calc(24px + env(safe-area-inset-bottom)); }
  #view-home, #view-rank, #view-ach, #view-hl, #view-about {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }
  .home-title { font-size: 25px; letter-spacing: 2px; }
  .home-sub { font-size: 11px; }
  .home-count, .home-tianli { font-size: 11px; padding: 6px 8px; }
  .box-grid { gap: 5px; }
  .box { width: calc((100% - 20px) / 5); aspect-ratio: unset; height: 62px; border-radius: 8px; }
  .box .num { font-size: 13px; }
  .box.opened .num { font-size: 9px; }
  .box.opened .amount-label { font-size: 8.5px; }
  .banker-area .offer { font-size: 28px; }
  .hud-chip b { font-size: 13px; }
  .lb-stats { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 17px; }
  .settle-title { font-size: 19px; }
}
