/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:      #07070f;
  --bg2:     #0d0d1a;
  --bg3:     #131326;
  --border:  #1e1e36;
  --border2: #2a2a48;
  --text:    #ddddf0;
  --muted:   #6868a0;
  --orange:  #f7931a;
  --cyan:    #00c8ff;
  --green:   #00e87a;
  --red:     #ff3355;
  --gold:    #ffd700;
  --ra:      #ff6b6b;
  --rb:      #4ecdc4;
  --rc:      #a78bfa;
  --rd:      #ffd93d;
  --card-bg: #0d0d1a;
  --radius:  12px;
  --shadow:  0 4px 24px rgba(0,0,0,.5);
}
html.day {
  --bg:      #f0f0f8;
  --bg2:     #ffffff;
  --bg3:     #e8e8f4;
  --border:  #d0d0e8;
  --border2: #c0c0dc;
  --text:    #111128;
  --muted:   #6060a0;
  --card-bg: #ffffff;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 16px;
  overflow-x: hidden;
  max-width: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  min-height: 100vh;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input  { outline: none; font-family: inherit; }

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center;
  padding: 0 16px; height: 58px;
  background: rgba(7,7,15,.93);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  width: 100%; box-sizing: border-box; overflow: hidden;
}
html.day .navbar { background: rgba(240,240,248,.93); }

.nav-logo { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; flex-shrink: 0; }
.logo-btc  { font-size: 1.5rem; color: var(--orange); font-weight: 900; }
.logo-text { font-size: 1.1rem; font-weight: 700; letter-spacing: .5px; }

.nav-right {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;          /* 推到最右 */
  min-width: 0; flex-shrink: 1;
}
.net-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); transition: background .3s; flex-shrink: 0;
}
.net-dot.ok  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.net-dot.err { background: var(--red); }

.bal-group { display: flex; gap: 6px; }
.bal-chip {
  padding: 4px 11px; border-radius: 20px;
  font-size: .82rem; font-weight: 600;
  background: var(--bg3); border: 1px solid var(--border2);
  white-space: nowrap;
}
.bal-chip.token { color: var(--orange); }
.bal-chip.bnb   { color: var(--cyan); }

.connect-btn {
  padding: 7px 18px; border-radius: 20px; border: none;
  background: var(--orange); color: #000;
  font-weight: 700; font-size: .9rem;
  transition: opacity .2s, transform .2s;
  white-space: nowrap; min-height: 38px;
  flex-shrink: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
}
.connect-btn:hover { opacity: .85; transform: scale(1.03); }
.connect-btn.connected {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border2);
}
.theme-btn {
  background: none; border: none; font-size: 1.2rem;
  padding: 4px; min-width: 34px; min-height: 34px;
}

/* ─── Views ──────────────────────────────────────────────────────────────── */
.view {
  display: none; max-width: 900px; margin: 0 auto;
  padding: 24px 16px calc(64px + env(safe-area-inset-bottom, 0px));
}
.view.active { display: block; }

/* ─── Card ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  text-align: center; padding: 72px 20px 56px;
  position: relative; overflow: hidden;
  min-height: 260px;
  border-radius: 16px;
  margin-bottom: 20px;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url('bg.jpg') center 30% / cover no-repeat;
  filter: blur(2px) brightness(0.55);
  transform: scale(1.04);
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
.hero-title {
  font-size: 3rem; font-weight: 900;
  background: linear-gradient(135deg, #ffb300, #ffe066, #ff7c00);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: 2px;
  filter: drop-shadow(0 2px 12px rgba(255,160,0,.55));
}
.hero-sub { margin-top: 14px; color: rgba(255,255,255,.75); font-size: 1.05rem; letter-spacing: .5px; text-shadow: 0 1px 8px rgba(0,0,0,.8); }

/* ─── Global Stats ───────────────────────────────────────────────────────── */
.global-stats {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 10px;
  margin-bottom: 24px;
}
.gs-item {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 10px; text-align: center;
}
.gs-val   { font-size: 1.3rem; font-weight: 700; color: var(--orange); }
.gs-label { font-size: .82rem; color: var(--muted); margin-top: 4px; }

/* ─── My Active Cards ────────────────────────────────────────────────────── */
.active-cards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.my-active-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg3); border: 1px solid var(--green);
  border-radius: 10px; padding: 14px 16px; cursor: pointer;
  transition: background .2s;
}
.my-active-card:hover { background: rgba(0,232,122,.06); }
.mac-dot  { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex-shrink: 0; animation: pulse 1.5s infinite; }
.mac-info { flex: 1; min-width: 0; }
.mac-pool { font-size: .92rem; font-weight: 600; }
.mac-status { font-size: .82rem; color: var(--muted); }
.mac-meta { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.mac-btn  { padding: 7px 14px; border: 1px solid var(--border2); border-radius: 6px; background: none; color: var(--text); font-size: .85rem; white-space: nowrap; min-height: 38px; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ─── Mode Tabs ──────────────────────────────────────────────────────────── */
.mode-tabs { display: flex; gap: 8px; margin-bottom: 0; }
.mode-tab {
  flex: 1; padding: 14px;
  background: var(--bg3); border: 1px solid var(--border2);
  border-bottom: none; border-radius: 10px 10px 0 0;
  color: var(--muted); font-size: 1rem; font-weight: 600;
  transition: all .2s; min-height: 50px;
}
.mode-tab.active.solo-active { background: rgba(247,147,26,.12); border-color: var(--orange); color: var(--orange); }
.mode-tab.active.trap-active { background: rgba(0,200,255,.10); border-color: var(--cyan);   color: var(--cyan); }

.mode-desc-bar {
  padding: 12px 16px; border-radius: 0 0 10px 10px;
  font-size: .9rem; font-weight: 500; text-align: center; margin-bottom: 16px;
}
.mode-desc-bar.solo { background: rgba(247,147,26,.1); color: var(--orange); border: 1px solid rgba(247,147,26,.3); border-top: none; }
.mode-desc-bar.trap { background: rgba(0,200,255,.08); color: var(--cyan);   border: 1px solid rgba(0,200,255,.25); border-top: none; }

/* ─── Tier Tabs (仅手机显示) ─────────────────────────────────────────────── */
.tier-tabs {
  display: none; /* 桌面隐藏 */
  gap: 8px; margin-bottom: 12px;
}
.tier-tab {
  flex: 1; padding: 10px 8px; border: 1px solid var(--border2);
  border-radius: 8px; background: var(--bg3);
  color: var(--muted); font-size: .95rem; font-weight: 600;
  transition: all .2s; min-height: 42px;
}
.tier-tab.active {
  background: var(--bg2); color: var(--text);
  border-color: var(--orange);
}

/* ─── Pool Grid ──────────────────────────────────────────────────────────── */
.pool-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 12px;
  margin-bottom: 24px;
}
.pool-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  transition: border-color .2s, transform .2s;
  position: relative; overflow: hidden;
}
.pool-card:hover { transform: translateY(-2px); }
.pool-card.solo { border-top: 2px solid var(--orange); }
.pool-card.trap { border-top: 2px solid var(--cyan); }
.pool-card.solo:hover { border-color: var(--orange); }
.pool-card.trap:hover { border-color: var(--cyan); }

.pc-tier { font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
.pc-min  { font-size: .88rem; color: var(--muted); margin-bottom: 12px; }
.pc-min span { color: var(--text); font-weight: 700; }
.pc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.pc-stat-label { font-size: .76rem; color: var(--muted); }
.pc-stat-val   { font-size: .92rem; font-weight: 600; }
.pc-prog { height: 4px; background: var(--border2); border-radius: 2px; margin-bottom: 14px; }
.pc-prog-fill { height: 100%; border-radius: 2px; transition: width .4s; }
.pool-card.solo .pc-prog-fill { background: var(--orange); }
.pool-card.trap .pc-prog-fill { background: var(--cyan); }
.pc-my-badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--green); color: #000;
  font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 10px;
}
.pc-enter-btn {
  width: 100%; padding: 11px; border: none; border-radius: 8px;
  font-weight: 700; font-size: .92rem; transition: opacity .2s; min-height: 44px;
}
.pool-card.solo .pc-enter-btn { background: var(--orange); color: #000; }
.pool-card.trap .pc-enter-btn { background: var(--cyan); color: #000; }
.pc-enter-btn:hover { opacity: .85; }

/* ─── Section Title ──────────────────────────────────────────────────────── */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .85rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin: 24px 0 12px;
}

/* ─── Home Rules ─────────────────────────────────────────────────────────── */
.home-rules-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px;
}
.hr-block {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 10px; padding: 14px;
}
.hr-title { font-size: .88rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.hr-text  { font-size: .82rem; color: var(--muted); line-height: 1.6; }

/* ─── My Records ─────────────────────────────────────────────────────────── */
.mr-summary {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 10px;
  padding: 14px 0; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.mr-stat   { text-align: center; }
.mr-val    { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.mr-val.green { color: var(--green); }
.mr-val.red   { color: var(--red); }
.mr-label  { font-size: .76rem; color: var(--muted); margin-top: 3px; }
.mr-flow-title {
  font-size: .78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;
}
.mr-flow { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto; }
.mr-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  font-size: .88rem;
}
.mr-icon  { font-size: 1.1rem; flex-shrink: 0; }
.mr-info  { flex: 1; min-width: 0; }
.mr-desc  { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-pool  { font-size: .76rem; color: var(--muted); margin-top: 1px; }
.mr-amount { font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.mr-amount.pos { color: var(--green); }
.mr-amount.neg { color: var(--red); }
.mr-time  { font-size: .74rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.mr-more {
  text-align: center; padding: 10px 0; font-size: .78rem;
  color: var(--muted); border-top: 1px solid var(--border); margin-top: 6px;
}

/* ─── Referral Card ──────────────────────────────────────────────────────── */
.ref-card { margin-bottom: 24px; }
.collapse-header {
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; font-weight: 600; user-select: none; min-height: 44px;
}
.collapse-arrow { color: var(--muted); font-size: .85rem; transition: transform .2s; }
.collapse-body { display: none; margin-top: 16px; }
.collapse-body.open { display: block; }

.ref-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.ref-label { font-size: .8rem; color: var(--muted); }
.ref-val   { font-size: 1rem; font-weight: 600; margin-top: 2px; }
.ref-val.accent { color: var(--orange); }

.ref-link-box { margin-bottom: 16px; }
.ref-link-label { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.ref-link-row {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 8px; padding: 10px 14px;
}
.ref-link-text { flex: 1; font-size: .8rem; color: var(--muted); word-break: break-all; min-width: 0; }
.ref-link-row button {
  flex-shrink: 0; padding: 6px 14px; border-radius: 6px;
  border: 1px solid var(--border2); background: var(--bg2);
  color: var(--text); font-size: .85rem; min-height: 36px;
}
.ref-btns { display: flex; gap: 8px; }
.ref-btns button {
  flex: 1; padding: 11px; border-radius: 8px; border: none;
  background: var(--orange); color: #000; font-weight: 700; font-size: .9rem; min-height: 44px;
}
.ref-btns button:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Hist Filters ───────────────────────────────────────────────────────── */
.hist-filters { display: flex; gap: 6px; }
.hf-btn {
  padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border2);
  background: none; color: var(--muted); font-size: .82rem;
  transition: all .15s; min-height: 32px;
}
.hf-btn.active { background: var(--orange); color: #000; border-color: var(--orange); font-weight: 700; }

/* ─── History Table ──────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin-bottom: 24px; -webkit-overflow-scrolling: touch; }
.hist-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.hist-table th {
  padding: 10px 10px; text-align: left;
  border-bottom: 1px solid var(--border2);
  color: var(--muted); font-weight: 600; font-size: .76rem;
  text-transform: uppercase; white-space: nowrap;
}
.hist-table td { padding: 10px 10px; border-bottom: 1px solid var(--border); }
.data-row { cursor: pointer; transition: background .15s; }
.data-row:hover { background: var(--bg3); }
.exp-row td { padding: 0; }
.exp-inner { display: none; padding: 0 10px; }
.exp-inner.open { display: block; padding: 14px 10px; }
.exp-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.exp-room {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 8px; padding: 12px;
}
.exp-room.winner-room { border-color: var(--green); background: rgba(0,232,122,.06); }
.exp-room-name  { font-weight: 600; font-size: .9rem; }
.winner-pip     { color: var(--green); font-size: .76rem; font-weight: 700; margin-left: 4px; }
.eliminated-pip { color: var(--red);   font-size: .76rem; font-weight: 700; margin-left: 4px; }
.exp-room-stats { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.tog-cell { color: var(--muted); font-size: .8rem; text-align: right; }

.empty-state { text-align: center; color: var(--muted); padding: 36px; font-size: .9rem; }
.green-cell { color: var(--green); font-weight: 600; }
.red-cell   { color: var(--red); }
.volt-cell  { color: var(--muted); }
.mono-cell  { font-family: monospace; font-size: .85rem; }
.gid-cell   { color: var(--muted); }

/* Surv badges */
.surv-badge { padding: 3px 9px; border-radius: 10px; font-size: .8rem; font-weight: 700; }
.sb-a { background: rgba(255,107,107,.15); color: var(--ra); }
.sb-b { background: rgba(78,205,196,.15);  color: var(--rb); }
.sb-c { background: rgba(167,139,250,.15); color: var(--rc); }
.sb-d { background: rgba(255,217,61,.15);  color: var(--rd); }
.sb-multi { background: rgba(0,232,122,.12); color: var(--green); }

/* Pool tag */
.pool-tag { padding: 3px 9px; border-radius: 6px; font-size: .76rem; font-weight: 700; }
.pool-tag.solo { background: rgba(247,147,26,.15); color: var(--orange); }
.pool-tag.trap { background: rgba(0,200,255,.12);  color: var(--cyan); }

/* Chip */
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { padding: 2px 7px; border-radius: 4px; font-size: .76rem; font-weight: 600; }
.chip-0 { background: rgba(255,107,107,.15); color: var(--ra); }
.chip-1 { background: rgba(78,205,196,.15);  color: var(--rb); }
.chip-2 { background: rgba(167,139,250,.15); color: var(--rc); }
.chip-3 { background: rgba(255,217,61,.15);  color: var(--rd); }

/* ─── Pool Detail Topbar ─────────────────────────────────────────────────── */
.pool-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; margin-bottom: 16px; flex-wrap: wrap;
  overflow: hidden;
}
.back-btn {
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border2); background: none;
  color: var(--text); font-size: .92rem;
  transition: background .15s; min-height: 42px; flex-shrink: 0;
}
.back-btn:hover { background: var(--bg3); }
.pool-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.mode-badge {
  padding: 5px 14px; border-radius: 20px;
  font-size: .84rem; font-weight: 700;
}
.mode-badge.solo { background: rgba(247,147,26,.15); color: var(--orange); border: 1px solid rgba(247,147,26,.3); }
.mode-badge.trap { background: rgba(0,200,255,.1);   color: var(--cyan);   border: 1px solid rgba(0,200,255,.25); }
.tier-badge {
  padding: 5px 14px; border-radius: 20px;
  background: var(--bg3); border: 1px solid var(--border2);
  font-size: .84rem; font-weight: 600; color: var(--muted);
}
.pool-desc { font-size: .88rem; color: var(--muted); width: 100%; }

/* ─── Game Status Card ───────────────────────────────────────────────────── */
.game-status { margin-bottom: 14px; }
.gs-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.gs-gid     { font-size: 1.15rem; font-weight: 700; }
.gs-players { color: var(--muted); font-size: .95rem; }
.gs-pool    { font-size: .95rem; }
.gs-pool span { color: var(--orange); font-weight: 700; }
.live-ind { display: flex; align-items: center; gap: 5px; font-size: .84rem; font-weight: 600; }
.live-pip { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.2s infinite; }
.live-pip.wait { background: var(--muted); animation: none; }
.prog-wrap { display: flex; flex-direction: column; gap: 10px; }
.prog-bar  { height: 5px; background: var(--border2); border-radius: 3px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 3px; background: var(--orange); transition: width .5s; }
.pip-row   { display: flex; gap: 6px; flex-wrap: wrap; }
.ppip {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--border2); transition: background .3s;
}
.ppip.room-a { background: var(--ra); }
.ppip.room-b { background: var(--rb); }
.ppip.room-c { background: var(--rc); }
.ppip.room-d { background: var(--rd); }
.ppip.mine   { box-shadow: 0 0 0 2px #fff; }

/* ─── My Banner ──────────────────────────────────────────────────────────── */
.my-banner {
  display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(0,232,122,.08); border: 1px solid rgba(0,232,122,.3);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 14px;
  font-size: .95rem;
}
.my-banner.show { display: flex; }
.banner-wait { color: var(--muted); font-size: .85rem; margin-left: auto; }
.room-badge { padding: 4px 14px; border-radius: 20px; font-weight: 700; font-size: .9rem; }
.rb-0 { background: rgba(255,107,107,.2); color: var(--ra); }
.rb-1 { background: rgba(78,205,196,.2);  color: var(--rb); }
.rb-2 { background: rgba(167,139,250,.2); color: var(--rc); }
.rb-3 { background: rgba(255,217,61,.2);  color: var(--rd); }

/* ─── Room Cards ─────────────────────────────────────────────────────────── */
.rooms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.room-card {
  background: var(--card-bg); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 18px; cursor: pointer;
  transition: all .2s; position: relative; overflow: hidden;
  user-select: none;
}
.room-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.room-card.room-a::before { background: var(--ra); }
.room-card.room-b::before { background: var(--rb); }
.room-card.room-c::before { background: var(--rc); }
.room-card.room-d::before { background: var(--rd); }

.room-card:hover { transform: translateY(-2px); }
.room-card.room-a:hover { border-color: var(--ra); box-shadow: 0 4px 20px rgba(255,107,107,.15); }
.room-card.room-b:hover { border-color: var(--rb); box-shadow: 0 4px 20px rgba(78,205,196,.15); }
.room-card.room-c:hover { border-color: var(--rc); box-shadow: 0 4px 20px rgba(167,139,250,.15); }
.room-card.room-d:hover { border-color: var(--rd); box-shadow: 0 4px 20px rgba(255,217,61,.15); }

.room-card.selected.room-a { border-color: var(--ra); background: rgba(255,107,107,.06); }
.room-card.selected.room-b { border-color: var(--rb); background: rgba(78,205,196,.06); }
.room-card.selected.room-c { border-color: var(--rc); background: rgba(167,139,250,.06); }
.room-card.selected.room-d { border-color: var(--rd); background: rgba(255,217,61,.06); }
.room-card.is-mine { outline: 2px solid var(--green); }

.mine-tag {
  display: none; position: absolute; top: 8px; right: 8px;
  background: var(--green); color: #000;
  font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 8px;
}
.room-card.is-mine .mine-tag { display: block; }

.room-top   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.room-letter { font-size: 1.8rem; font-weight: 900; }
.room-card.room-a .room-letter { color: var(--ra); }
.room-card.room-b .room-letter { color: var(--rb); }
.room-card.room-c .room-letter { color: var(--rc); }
.room-card.room-d .room-letter { color: var(--rd); }
.room-tick { color: var(--green); font-size: 1.1rem; opacity: 0; transition: opacity .2s; }
.room-tick.on { opacity: 1; }

.room-data { display: flex; gap: 12px; margin-bottom: 10px; }
.rd-label  { font-size: .74rem; color: var(--muted); }
.rd-value  { font-size: .92rem; font-weight: 600; }
.rd-item   { flex: 1; }

.room-bar-track { height: 3px; background: var(--border2); border-radius: 2px; margin-bottom: 10px; }
.room-bar-fill  { height: 100%; border-radius: 2px; transition: width .4s; }
.room-a .room-bar-fill { background: var(--ra); }
.room-b .room-bar-fill { background: var(--rb); }
.room-c .room-bar-fill { background: var(--rc); }
.room-d .room-bar-fill { background: var(--rd); }

.room-est       { font-size: .82rem; color: var(--muted); }
.room-est-value { font-weight: 600; color: var(--text); margin-left: 4px; }
.room-est.show .room-est-value { color: var(--green); }

/* ─── Join Panel ─────────────────────────────────────────────────────────── */
.join-panel { margin-bottom: 16px; }
.join-title { font-weight: 700; font-size: 1rem; margin-bottom: 14px; }
.sel-tag {
  display: inline-block; padding: 5px 14px; border-radius: 20px;
  font-size: .88rem; font-weight: 600; margin-bottom: 14px;
  background: var(--bg3); border: 1px solid var(--border2); color: var(--muted);
}
.sel-tag.srt-a { background: rgba(255,107,107,.1); border-color: var(--ra); color: var(--ra); }
.sel-tag.srt-b { background: rgba(78,205,196,.1);  border-color: var(--rb); color: var(--rb); }
.sel-tag.srt-c { background: rgba(167,139,250,.1); border-color: var(--rc); color: var(--rc); }
.sel-tag.srt-d { background: rgba(255,217,61,.1);  border-color: var(--rd); color: var(--rd); }

.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.preset-btn {
  padding: 7px 16px; border-radius: 20px;
  border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text); font-size: .88rem;
  transition: all .15s; min-height: 38px;
}
.preset-btn:hover { border-color: var(--orange); color: var(--orange); }

.amount-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.amount-row input {
  flex: 1; padding: 12px 14px;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 8px; color: var(--text); font-size: 1rem;
}
.amount-row input:focus { border-color: var(--orange); }
.amt-unit { color: var(--muted); font-size: .9rem; font-weight: 600; flex-shrink: 0; }

.calc-box {
  display: none; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 14px;
}
.calc-box.show { display: block; }
.calc-row { display: flex; justify-content: space-between; font-size: .9rem; padding: 4px 0; }
.calc-row.red   span:last-child { color: var(--red); }
.calc-row.green span:last-child { color: var(--green); font-weight: 600; }

.bnb-note { font-size: .84rem; color: var(--muted); padding: 6px 0; margin-bottom: 10px; }
.bnb-note b { color: var(--cyan); }

.join-btn {
  width: 100%; padding: 15px; border: none; border-radius: 10px;
  background: var(--orange); color: #000;
  font-weight: 700; font-size: 1.05rem;
  transition: opacity .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
}
.join-btn:disabled { opacity: .4; cursor: not-allowed; }
.join-btn:not(:disabled):hover { opacity: .85; }

.dep-note { font-size: .84rem; color: var(--muted); margin-top: 8px; text-align: center; }
.dep-note.warn { color: var(--gold); }
.hl { color: var(--orange); }

/* ─── My Estimate ────────────────────────────────────────────────────────── */
.my-est { margin-bottom: 16px; }
.est-title { font-weight: 700; font-size: 1rem; margin-bottom: 14px; }
.est-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.est-label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 3px; }
.est-ret   { color: var(--green); font-weight: 700; font-size: 1.1rem; }

/* ─── Rules ──────────────────────────────────────────────────────────────── */
.rules-body.open p { margin-bottom: 10px; font-size: .9rem; line-height: 1.7; }
.rule-example { color: var(--muted); font-size: .85rem !important; }

/* ─── Algo Log ───────────────────────────────────────────────────────────── */
.algo-badge {
  padding: 3px 9px; border-radius: 10px;
  background: rgba(0,200,255,.1); color: var(--cyan);
  font-size: .72rem; font-weight: 700; border: 1px solid rgba(0,200,255,.25);
  text-transform: none; letter-spacing: 0;
}
.algo-log {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  margin-bottom: 16px; max-height: 300px; overflow-y: auto;
  font-size: .84rem;
}
.algo-empty { color: var(--muted); font-style: italic; }
.algo-entry { border-bottom: 1px solid var(--border); padding: 10px 0; }
.algo-entry:last-child { border-bottom: none; }
.ae-header { display: flex; align-items: center; gap: 8px; cursor: pointer; flex-wrap: wrap; }
.ae-gid { color: var(--muted); }
.ae-seed-short { color: var(--muted); font-size: .76rem; font-family: monospace; margin-left: auto; }
.ae-arrow { color: var(--muted); font-size: .76rem; transition: transform .2s; }
.ae-calc { display: none; }
.ae-calc.open { display: block; }
.ae-calc-inner { padding: 8px 0; font-size: .8rem; color: var(--muted); }
.ae-section { margin-bottom: 8px; }
.ae-section-title { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.ae-row { font-family: monospace; margin: 2px 0; word-break: break-all; overflow-wrap: break-word; }
.ae-row span { color: var(--text); }
.ae-result-row { color: var(--text); font-weight: 600; margin-top: 6px; }
.ae-txlink { margin-left: 10px; font-size: .8rem; color: var(--cyan); }

.hist-count { font-size: .84rem; color: var(--muted); font-weight: normal; text-transform: none; letter-spacing: 0; }

/* ─── Pool Footer ────────────────────────────────────────────────────────── */
.pool-footer {
  font-size: .82rem; color: var(--muted); text-align: center; padding: 12px 0 4px;
  word-break: break-all; overflow-wrap: break-word;
}
.pool-footer span { font-family: monospace; }
.pool-footer a { margin-left: 8px; }

/* ─── Modals ─────────────────────────────────────────────────────────────── */
.modal-bg {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.72); backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 20px 20px 0 0; padding: 28px 24px;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp .25s ease;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
@keyframes slideUp { from{opacity:0;transform:translateY(40px)} to{opacity:1;transform:translateY(0)} }
.modal-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 18px; }

/* Result modal */
.result-modal { text-align: center; }
.result-emoji { font-size: 3.5rem; margin-bottom: 8px; }
.result-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
.result-sub   { color: var(--muted); font-size: .95rem; margin-bottom: 18px; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 16px; }
.rstat-item  { background: var(--bg3); border-radius: 8px; padding: 12px 8px; }
.rstat-label { font-size: .76rem; color: var(--muted); }
.rstat-value { font-size: 1rem; font-weight: 700; margin-top: 3px; }
.result-nopay { color: var(--gold); font-size: .88rem; margin-bottom: 14px; }
.modal-close-btn {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--orange); color: #000; font-weight: 700; font-size: 1rem;
  min-height: 50px;
}

/* Wallet picker */
#wpickList { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.wpick-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text); font-size: 1rem; font-weight: 600;
  transition: background .15s; min-height: 54px;
}
.wpick-item:hover { background: var(--border2); }
.wpick-icon { font-size: 1.5rem; }
.modal-cancel-btn {
  width: 100%; padding: 12px; border-radius: 12px;
  border: 1px solid var(--border2); background: none;
  color: var(--muted); font-size: .95rem; min-height: 46px;
}

/* Bind ref */
.bindref-addr { font-size: .84rem; color: var(--muted); font-family: monospace; margin-bottom: 14px; word-break: break-all; }
.bindref-benefits { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; font-size: .92rem; }
.modal-btns { display: flex; gap: 8px; }
.modal-btns button {
  flex: 1; padding: 13px; border-radius: 12px; border: none;
  background: var(--orange); color: #000; font-weight: 700; font-size: .95rem; min-height: 50px;
}
.modal-btns button.btn-ghost { background: none; border: 1px solid var(--border2); color: var(--muted); }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  right: 16px; left: 16px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.t-item {
  padding: 12px 18px; border-radius: 12px; font-size: .9rem; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(12px);
  transition: all .3s; max-width: 340px; word-break: break-word;
  pointer-events: auto;
}
.t-item.show { opacity: 1; transform: translateY(0); }
.t-item.ok   { background: var(--green); color: #000; }
.t-item.err  { background: var(--red); color: #fff; }
.t-item.warn { background: var(--gold); color: #000; }
.t-item.info { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }

/* ─── Spinner ────────────────────────────────────────────────────────────── */
.spin {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,.3); border-top-color: #000;
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive: Tablet 768px ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-title { font-size: 2.6rem; }
  .bal-chip.bnb { display: none; }
}

/* ─── Responsive: Mobile 600px ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .view { padding: 14px 12px calc(72px + env(safe-area-inset-bottom, 0px)); }

  /* Navbar 紧凑 */
  .navbar { padding: 0 12px; height: 54px; }
  .logo-text { font-size: .95rem; }
  .nav-right { gap: 6px; }
  .bal-chip.bnb { display: none; }     /* 手机隐藏 BNB，保留 TOKEN */
  .bal-chip { font-size: .78rem; padding: 3px 8px; }
  .connect-btn {
    padding: 6px 10px; font-size: .82rem;
    max-width: 100px;                  /* 压缩地址按钮宽度 */
  }

  /* Hero */
  .hero { padding: 28px 12px 20px; }
  .hero-title { font-size: 2.2rem; }
  .hero-sub   { font-size: .95rem; }

  /* Stats: 2列 */
  .global-stats { grid-template-columns: repeat(2,1fr); }
  .gs-val { font-size: 1.2rem; }

  /* Mode tabs */
  .mode-tab { font-size: .92rem; padding: 12px 8px; min-height: 46px; }
  .mode-desc-bar { font-size: .85rem; }

  /* Tier tabs: 手机显示 */
  .tier-tabs { display: flex; }

  /* Pool grid: 单列 */
  .pool-grid { grid-template-columns: 1fr; gap: 10px; }

  /* Room cards: 2列保持，内边距收紧 */
  .rooms-grid { gap: 8px; }
  .room-card  { padding: 14px; }
  .room-letter { font-size: 1.6rem; }

  /* History: 隐藏次要列 */
  .glob-hist th:nth-child(4), .glob-hist td:nth-child(4),
  .glob-hist th:nth-child(6), .glob-hist td:nth-child(6),
  .glob-hist th:nth-child(7), .glob-hist td:nth-child(7) { display: none; }

  .pool-hist th:nth-child(3), .pool-hist td:nth-child(3),
  .pool-hist th:nth-child(5), .pool-hist td:nth-child(5),
  .pool-hist th:nth-child(6), .pool-hist td:nth-child(6) { display: none; }

  .hist-table th, .hist-table td { padding: 9px 7px; font-size: .84rem; }
  .exp-grid { grid-template-columns: 1fr 1fr; }

  /* Pool detail topbar */
  .pool-topbar { gap: 8px; padding: 8px 0; margin-bottom: 10px; max-width: 100%; }
  .back-btn { padding: 7px 12px; font-size: .88rem; min-height: 38px; }

  /* 防止 section-title 溢出 */
  .section-title { gap: 8px; }

  /* 历史表格容器不超出屏幕 */
  .table-wrap { max-width: 100%; }
  .hist-table { min-width: 0; }

  /* 规则卡片：手机单列 */
  .home-rules-grid { grid-template-columns: 1fr; gap: 8px; }

  /* 我的记录：手机 2 列 */
  .mr-summary { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .mr-val { font-size: 1rem; }

  .join-title { margin-bottom: 10px; }

  /* Modals: 底部弹出样式保持，内边距收紧 */
  .modal { padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .result-stats { grid-template-columns: 1fr 1fr; }

  /* Toast */
  .t-item { max-width: 100%; }

  /* Algo log 长字符换行 */
  .algo-log { font-size: .78rem; }
}

/* ─── Responsive: Small phone 400px ─────────────────────────────────────── */
@media (max-width: 400px) {
  .hero-title  { font-size: 1.9rem; }
  .bal-group   { display: none; }      /* 极小屏完全隐藏余额 */
  .connect-btn { max-width: 88px; }
  .pool-card   { padding: 14px; }
}
