/* ==================== 全局样式 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2240;
  --text-primary: #e8eaf6;
  --text-secondary: #94a3b8;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --gold: #f59e0b;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --border: rgba(255,255,255,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

#app { min-height: 100vh; }

.page { display: none; min-height: 100vh; }
.page.active { display: block; }
/* 台球 iframe 全屏覆盖 */
#page-billiard.page.active {
  position: fixed; inset: 0; z-index: 10;
  background: #000;
}
#page-billiard iframe { width: 100%; height: 100%; border: none; }

/* ==================== 登录页 ==================== */
.login-bg {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0e1a 0%, #1a1040 50%, #0d1b2a 100%);
  position: relative;
  overflow: hidden;
}
.login-bg::before {
  content: ''; position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(124,58,237,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(59,130,246,0.06) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite;
}
@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(2%, 1%); }
}

.login-card {
  position: relative; z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  min-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-logo { font-size: 32px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.login-subtitle { font-size: 16px; color: var(--text-secondary); margin-bottom: 32px; }
.login-status { color: var(--text-secondary); margin-bottom: 20px; font-size: 14px; }
.login-info { margin-top: 20px; font-size: 12px; color: var(--text-secondary); }
.login-hint { font-size: 12px; color: var(--red); margin-top: 6px; min-height: 18px; }
.login-chain-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(130,71,229,0.15); border: 1px solid rgba(130,71,229,0.4);
  border-radius: 20px; padding: 4px 14px; font-size: 12px; font-weight: 600;
  color: #9b6dff; margin-bottom: 20px;
}
.chain-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #9b6dff; animation: chainPulse 2s infinite;
}
@keyframes chainPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ==================== 按钮 ==================== */
.btn {
  padding: 12px 24px; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 15px; font-weight: 600;
  transition: all 0.2s; display: inline-block; text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6d28d9; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { background: rgba(255,255,255,0.05); }
.btn-accent { background: #10b981; color: #fff; }
.btn-accent:hover { background: #059669; }
.btn-large { padding: 16px 40px; font-size: 17px; min-width: 240px; }
.btn-small { padding: 6px 14px; font-size: 13px; white-space: nowrap; }
.btn-back {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-primary); padding: 6px 14px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
}
.btn-back:hover { background: rgba(255,255,255,0.05); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* ==================== 顶部栏 ==================== */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.page-title { font-size: 18px; font-weight: 600; }
.logo-text { font-size: 20px; font-weight: 700; }
.wallet-info { display: flex; gap: 16px; align-items: center; font-size: 14px; }
.sbc-balance { color: var(--gold); font-weight: 600; }
.avatar-circle {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); display: flex; align-items: center;
  justify-content: center; font-size: 18px; color: #fff;
}

/* ==================== 主页 ==================== */
.home-content { padding: 20px; max-width: 900px; margin: 0 auto; }
.home-menu {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.menu-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 16px;
  text-align: center; cursor: pointer; transition: all 0.2s;
  display: flex; flex-direction: column; gap: 8px; color: var(--text-primary);
}
.menu-btn:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 24px rgba(124,58,237,0.15); }
.menu-icon { font-size: 36px; }
.menu-label { font-size: 16px; font-weight: 600; }
.menu-desc { font-size: 12px; color: var(--text-secondary); }

/* ==================== 人机对战选择 ==================== */
.ai-select, .match-select {
  padding: 32px 20px; max-width: 700px; margin: 0 auto;
}
.ai-select h3, .match-select h3 { text-align: center; margin-bottom: 24px; font-size: 20px; }
.ai-levels, .room-levels {
  display: flex; flex-direction: column; gap: 12px;
}
.ai-level-btn, .room-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; cursor: pointer;
  transition: all 0.2s; text-align: left; display: flex;
  align-items: center; gap: 16px; color: var(--text-primary);
}
.ai-level-btn:hover, .room-btn:hover {
  border-color: var(--accent); background: rgba(124,58,237,0.1);
}
.level-star { font-size: 24px; }
.level-name { font-size: 18px; font-weight: 600; min-width: 60px; }
.level-desc { color: var(--text-secondary); font-size: 14px; }
.ai-info { text-align: center; margin-top: 24px; color: var(--text-secondary); font-size: 13px; }

/* 房间等级 */
.room-name { font-size: 18px; font-weight: 600; flex: 1; }
.room-stake { color: var(--gold); font-weight: 600; }
.room-fee { color: var(--red); font-size: 13px; }
.room-pool { color: var(--green); font-weight: 600; }

/* ==================== 充值页 ==================== */
.recharge-content { padding: 20px; max-width: 500px; margin: 0 auto; }
.recharge-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.recharge-card h3 { margin-bottom: 12px; }
.rate-text { color: var(--gold); margin-bottom: 20px; font-size: 14px; }
.recharge-input { margin-bottom: 20px; }
.recharge-input label { display: block; margin-bottom: 6px; color: var(--text-secondary); }
.recharge-input input {
  width: 100%; padding: 10px 14px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 16px;
}
.order-list { margin-top: 20px; }
.order-item {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px;
}
.order-item .order-status { font-weight: 600; }
.order-status.pending { color: var(--gold); }
.order-status.success { color: var(--green); }
.order-status.expired { color: var(--text-secondary); }

/* 充值地址复制 */
.recharge-address-box {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.recharge-address-label {
  font-size: 13px; color: var(--text-secondary); white-space: nowrap; min-width: 110px;
}
.recharge-address {
  flex: 1; font-size: 12px; color: var(--accent-light);
  background: var(--bg-secondary); padding: 6px 10px;
  border-radius: var(--radius-sm); word-break: break-all;
  font-family: 'Courier New', monospace; min-width: 0;
}
.btn-copy-sm {
  background: var(--bg-secondary); border: 1px solid var(--border);
  color: var(--text-primary); padding: 4px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px; white-space: nowrap;
}
.btn-copy-sm:hover { background: var(--accent); color: #fff; }
.btn-copy-sm.copied { background: var(--green); color: #fff; }
.btn-secondary {
  background: var(--bg-secondary); border: 1px solid var(--border);
  color: var(--text-primary); padding: 12px 20px; border-radius: var(--radius);
  cursor: pointer; font-size: 15px; font-weight: 600; text-align: center;
}
.btn-secondary:hover { background: var(--bg-card); border-color: var(--accent); }
.recharge-hint { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

/* ==================== NFT 页 ==================== */
.nft-content { padding: 20px; max-width: 600px; margin: 0 auto; }
.nft-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.nft-tab {
  flex: 1; padding: 10px; background: var(--bg-secondary);
  border: 1px solid var(--border); color: var(--text-secondary);
  cursor: pointer; font-size: 14px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.nft-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.nft-panel { display: none; background: var(--bg-card); border: 1px solid var(--border); padding: 20px; border-radius: 0 var(--radius) var(--radius) var(--radius); }
.nft-panel.active { display: block; }
.nft-levels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nft-level-btn {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px; text-align: center;
  cursor: pointer; color: var(--text-primary); font-size: 14px;
  transition: all 0.2s;
}
.nft-level-btn:hover { border-color: var(--accent); background: rgba(124,58,237,0.1); }
.nft-subtitle { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }
.nft-level-badge { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; font-size: 22px; font-weight: 800; flex-shrink: 0; }
.badge-a { background: rgba(96,165,250,0.18); color: #60a5fa; }
.badge-b { background: rgba(167,139,250,0.18); color: #a78bfa; }
.badge-c { background: rgba(244,114,182,0.18); color: #f472b6; }
.badge-s { background: rgba(251,191,36,0.18); color: #fbbf24; }

/* 铸造卡片 */
.nft-mint-cards { display: flex; flex-direction: column; gap: 14px; }
.nft-mint-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  transition: border-color 0.2s;
  display: flex; align-items: stretch; justify-content: space-between; gap: 16px;
}
.nft-mint-body { flex: 1; min-width: 0; }
.mint-success-toast {
  min-width: 180px; max-width: 240px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 13px; line-height: 1.5;
  color: #4ade80; border-left: 2px solid #22c55e;
  padding: 10px 14px; border-radius: 8px;
  background: rgba(34,197,94,0.08); opacity: 0; transform: translateX(10px);
  transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
.mint-success-toast.show { opacity: 1; transform: translateX(0); pointer-events: auto; }
.nft-mint-card:hover { border-color: var(--accent); }
.nft-mint-header { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.nft-mint-info { display: flex; flex-direction: column; }
.nft-level-name { font-size: 16px; font-weight: 600; }
.nft-level-price { font-size: 13px; color: var(--gold); }
.nft-level-desc { font-size: 12px; color: var(--text-secondary); margin: 4px 0 12px; }
.nft-mint-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nft-quantity-box { display: flex; align-items: center; gap: 0; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.qty-btn {
  width: 30px; height: 32px; border: none; background: transparent;
  color: var(--text-primary); font-size: 16px; cursor: pointer;
  transition: background 0.15s; display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { background: rgba(255,255,255,0.1); }
.nft-qty-input {
  width: 48px; height: 32px; border: none; border-left: 1px solid var(--border);
  border-right: 1px solid var(--border); background: transparent;
  color: var(--text-primary); text-align: center; font-size: 15px; font-weight: 600;
  -moz-appearance: textfield;
}
.nft-qty-input::-webkit-inner-spin-button, .nft-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qty-label { padding: 0 8px; font-size: 13px; color: var(--text-secondary); }
.mint-subtotal { font-size: 13px; color: var(--text-secondary); min-width: 140px; }
.mint-subtotal strong { color: var(--gold); }
.mint-total { text-align: right; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 16px; color: var(--text-primary); }
.mint-total strong { color: var(--gold); font-size: 20px; }

/* 我的NFT计数条 */
.nft-count-bar {
  display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.nft-count-tag {
  padding: 4px 12px; border-radius: 14px; font-size: 12px; font-weight: 600;
}
.nft-count-tag.a { background: rgba(96,165,250,0.15); color: #60a5fa; border: 1px solid rgba(96,165,250,0.3); }
.nft-count-tag.b { background: rgba(167,139,250,0.15); color: #a78bfa; border: 1px solid rgba(167,139,250,0.3); }
.nft-count-tag.c { background: rgba(244,114,182,0.15); color: #f472b6; border: 1px solid rgba(244,114,182,0.3); }
.nft-count-tag.s { background: rgba(251,191,36,0.15); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); }

/* 我的 NFT 列表 */
.nft-item {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.nft-item-left { display: flex; align-items: center; gap: 10px; }
.nft-dot { font-size: 18px; }
.nft-item-id { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.nft-item-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.nft-item-right { display: flex; align-items: center; gap: 10px; }
.nft-status { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 10px; }
.nft-empty { text-align: center; padding: 40px 20px; }
.nft-empty-icon { font-size: 48px; margin-bottom: 12px; }
.nft-empty p { color: var(--text-secondary); margin-bottom: 12px; }
.nft-empty-hint { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.nft-empty-text { color: var(--text-secondary); font-size: 13px; padding: 12px 0; text-align: center; }
.nft-empty-text small { font-size: 11px; display: block; margin-top: 4px; }
.nft-card-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: center; }

/* 收藏馆卡片补充 */
.nft-card-owned { margin-top: 8px; font-size: 12px; color: var(--green); }
.nft-card-mint-box {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; justify-content: center;
  font-size: 12px; color: var(--text-secondary);
}
.nft-card-mint-box strong { color: var(--gold); }
.nft-card-qty { width: 44px !important; }

/* 销毁结果 */
.burn-result {
  margin-top: 16px; padding: 14px; background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25); border-radius: var(--radius-sm);
  color: var(--gold); font-size: 14px; text-align: center;
}

/* NFT 编号弹窗 */
.modal-nft-body { max-height: 60vh; overflow-y: auto; margin-bottom: 14px; }
.nft-id-tag {
  display: inline-block; padding: 4px 10px; margin: 3px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 12px; font-family: 'Courier New', monospace;
  cursor: pointer; color: var(--text-primary); transition: all 0.15s;
}
.nft-id-tag:hover { border-color: var(--accent); color: var(--accent-light); }
.nft-id-tag.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.nft-from-burn { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* NFT 品类网格卡片 */
.nft-level-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.nft-level-cell {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; text-align: center;
  cursor: pointer; transition: all 0.2s;
}
.nft-level-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
.nft-level-cell .cell-icon { font-size: 28px; margin-bottom: 4px; }
.nft-level-cell .cell-name { font-size: 14px; font-weight: 600; }
.nft-level-cell .cell-count {
  font-size: 22px; font-weight: 800; margin: 4px 0;
  color: var(--accent-light);
}
.nft-level-cell .cell-hint { font-size: 11px; color: var(--text-secondary); }


/* NFT 分类折叠区 */
.nft-category {
  margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden;
}
.nft-cat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--bg-secondary);
  cursor: pointer; user-select: none; transition: background 0.15s;
}
.nft-cat-header:hover { background: rgba(255,255,255,0.03); }
.nft-cat-badge {
  background: var(--accent); color: #fff; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 600; min-width: 24px; text-align: center;
}
.nft-cat-badge.pending { background: #f59e0b; }
.nft-cat-arrow { margin-left: auto; font-size: 14px; color: var(--text-secondary); transition: transform 0.2s; }
.nft-cat-arrow.open { transform: rotate(180deg); }
.nft-cat-body { display: none; padding: 0 12px 12px; }
.nft-cat-body.open { display: block; }

/* 销毁选择区 */
.burn-select-area { margin-top: 12px; }
.burn-select-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 6px;
}
.burn-select-item .nft-dot { font-size: 16px; }
.burn-select-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.burn-select-right { display: flex; align-items: center; gap: 8px; }
.burn-select-subsidy { font-size: 12px; color: var(--gold); white-space: nowrap; }
.burn-select-qty { width: 48px !important; }

/* 订单状态标签 */
.order-status-tag {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.order-status-tag.processing { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.order-status-tag.confirmed { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.order-status-tag.collect { background: rgba(167,139,250,0.15); color: #a78bfa; border: 1px solid rgba(167,139,250,0.3); }
.order-status-tag.burn { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }

/* NFT 收藏馆 */
.nft-collection-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.nft-card {
  background: linear-gradient(135deg, #1a2240 0%, #1e2a4a 100%);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all 0.3s;
  cursor: default;
}
.nft-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 8px 30px rgba(124,58,237,0.2); }
.nft-card-icon { font-size: 48px; margin-bottom: 10px; }
.nft-card-level { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.nft-card-status { font-size: 13px; margin: 4px 0; padding: 4px 10px; border-radius: 6px; text-align: center; }
.nft-status-collect { background: rgba(96,165,250,0.15); color: #60a5fa; border: 1px solid rgba(96,165,250,0.4); animation: pulse 2s infinite; }
.nft-status-burn { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.4); animation: pulse 2s infinite; }
.nft-status-ready { background: rgba(74,222,128,0.08); color: #4ade80; border: 1px solid rgba(74,222,128,0.3); opacity: 0.6; }
.nft-card-price { color: var(--gold); font-size: 14px; margin-bottom: 6px; }
.nft-card-desc { color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.nft-card-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; margin-bottom: 8px; }
.nft-badge-a { background: rgba(96,165,250,0.2); color: #60a5fa; border: 1px solid #60a5fa; }
.nft-badge-b { background: rgba(167,139,250,0.2); color: #a78bfa; border: 1px solid #a78bfa; }
.nft-badge-c { background: rgba(244,114,182,0.2); color: #f472b6; border: 1px solid #f472b6; }
.nft-badge-s { background: rgba(251,191,36,0.2); color: #fbbf24; border: 1px solid #fbbf24; }

/* 邀请链接 */
.invite-link-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px; margin-bottom: 10px;
}
.invite-link-box input {
  flex: 1; padding: 12px 14px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 14px; font-family: monospace;
}
.invite-link-box .btn.copied {
  background: #10b981; border-color: #10b981; color: #fff;
}
.invite-tip { font-size: 12px; color: #10b981; margin-bottom: 12px; }
.invite-rewards { display: flex; gap: 12px; margin-bottom: 12px; }
.invite-team-list { max-height: 180px; overflow-y: auto; margin-bottom: 12px; }
.invite-team-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 4px; font-size: 13px;
}
.invite-team-gen { font-size: 10px; padding: 2px 6px; border-radius: 8px; }
.invite-team-gen.gen1 { background: rgba(96,165,250,0.2); color: #60a5fa; }
.invite-team-gen.gen2 { background: rgba(167,139,250,0.2); color: #a78bfa; }
.manager-tip { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }

/* ==================== 邀请页 ==================== */
.invite-content { padding: 20px; max-width: 500px; margin: 0 auto; }
.invite-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.invite-link { font-size: 12px; color: var(--text-secondary); word-break: break-all; margin-bottom: 20px; }
.invite-stats { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-item { flex: 1; text-align: center; background: var(--bg-secondary); border-radius: var(--radius-sm); padding: 12px; }
.stat-num { display: block; font-size: 22px; font-weight: 700; color: var(--accent-light); }
.stat-label { font-size: 11px; color: var(--text-secondary); }
.manager-section { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.manager-section h4 { margin-bottom: 8px; }
.manager-section p { margin-bottom: 10px; color: var(--text-secondary); }
.manager-section .btn { margin-right: 8px; margin-top: 6px; }

/* ==================== 社区页 ==================== */
.community-content { padding: 20px; max-width: 550px; margin: 0 auto; }
.community-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.community-card h3 { font-size: 18px; margin-bottom: 14px; }
.community-warn { color: #f59e0b; font-size: 13px; line-height: 1.7; margin-bottom: 18px; padding: 10px 14px; background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); border-radius: var(--radius-sm); }
.community-section { margin-bottom: 16px; }
.community-step { color: var(--text-secondary); font-size: 13px; line-height: 1.8; margin-bottom: 4px; }
.community-step a { color: var(--accent-light); text-decoration: underline; }
.community-info-box {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 16px;
}
.community-info-row {
  display: flex; align-items: baseline; gap: 10px; padding: 4px 0;
  font-size: 14px; line-height: 1.6;
}
.community-info-row span { color: var(--text-secondary); min-width: 60px; flex-shrink: 0; }
.community-info-row strong { color: var(--text-primary); }
.community-info-row code {
  font-size: 12px; color: var(--accent-light);
  word-break: break-all; font-family: 'Courier New', monospace;
  user-select: all;
}
.community-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.community-hint { text-align: center; font-size: 13px; color: var(--green); min-height: 20px; margin-top: 10px; }

/* ==================== 排行榜 ==================== */
.rank-content { padding: 20px; max-width: 700px; margin: 0 auto; }
.rank-header {
  display: flex; padding: 12px 16px; background: var(--bg-card);
  border-radius: var(--radius-sm); margin-bottom: 8px; font-weight: 600; font-size: 14px; color: var(--text-secondary);
}
.rank-col { text-align: center; }
.rank-col-1 { width: 60px; }
.rank-col-2 { flex: 1; text-align: left; }
.rank-col-3 { width: 80px; }
.rank-col-4 { width: 80px; }
.rank-col-5 { width: 100px; }
.rank-item {
  display: flex; padding: 14px 16px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 6px; align-items: center; transition: all 0.2s;
}
.rank-item:hover { border-color: var(--accent); }
.rank-item.top-1 { border-color: #f59e0b; }
.rank-item.top-2 { border-color: #94a3b8; }
.rank-item.top-3 { border-color: #d97706; }
.rank-pos { font-weight: 700; font-size: 16px; }
.rank-medal { font-size: 24px; }

/* ==================== 设置页 ==================== */
.setting-content { padding: 20px; max-width: 500px; margin: 0 auto; }
.setting-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.setting-item input[type="range"] { width: 120px; accent-color: var(--accent); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #444; transition: .3s; border-radius: 24px;
}
.slider:before {
  position: absolute; content: ""; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background-color: white;
  transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--green); }
input:checked + .slider:before { transform: translateX(20px); }

/* ==================== 游戏棋盘页 ==================== */
.game-layout {
  display: flex; gap: 16px; padding: 10px 16px;
  max-width: 1000px; margin: 0 auto; align-items: flex-start;
}
.game-left, .game-right { width: 160px; flex-shrink: 0; }
.game-center { flex: 1; display: flex; flex-direction: column; align-items: center; }
.player-info {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; text-align: center; margin-bottom: 10px;
}
.player-avatar { font-size: 40px; }
.player-detail { margin-top: 8px; }
.player-badge { font-size: 11px; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 10px; }
.game-score { text-align: center; font-size: 22px; font-weight: 700; margin: 8px 0; }
#game-canvas {
  background: #1a1a2e;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  height: auto;
  max-width: 600px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.game-status {
  margin-top: 12px; font-size: 16px; font-weight: 600;
  color: var(--accent-light); text-align: center;
}
.game-timer-bar {
  text-align: center; font-size: 20px; font-weight: 700;
  margin-top: 8px; min-height: 28px;
}
.game-timer-cont {
  transition: color 0.3s;
}
.game-btn-row {
  display: flex; justify-content: center; gap: 10px;
  margin-top: 10px;
}
.move-history {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; max-height: 480px; overflow-y: auto;
}
.move-history h4 { margin-bottom: 8px; font-size: 14px; color: var(--text-secondary); }
.move-item { padding: 2px 0; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.03); }
.move-item.black { color: #fff; }
.move-item.white { color: #ddd; }

/* ==================== 匹配等待 ==================== */
.matchmaking-content { text-align: center; padding-top: 80px; }
.spinner {
  width: 50px; height: 50px; border: 4px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.matchmaking-content h3 { margin-bottom: 10px; }
.matchmaking-content p { color: var(--text-secondary); }

/* ==================== 弹窗 ==================== */
.modal {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 999;
  align-items: center; justify-content: center;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; text-align: center;
  min-width: 320px; max-width: 400px;
}
.modal-content h2 { margin-bottom: 12px; }
.modal-content p { color: var(--text-secondary); margin-bottom: 20px; }
.gameover-reward { margin: 12px 0; padding: 12px; background: var(--bg-secondary); border-radius: var(--radius-sm); color: var(--gold); font-weight: 600; }

/* ==================== Toast ==================== */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 12px 24px; border-radius: var(--radius-sm);
  z-index: 9999; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.toast.show { opacity: 1; }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  /* 登录页 */
  .login-card { min-width: auto; width: calc(100% - 32px); margin: 0 16px; padding: 32px 20px; }
  .login-logo { font-size: 26px; }
  .login-subtitle { font-size: 14px; margin-bottom: 24px; }
  .btn-large { padding: 14px 20px; font-size: 15px; min-width: 200px; }

  /* 顶部栏 */
  .top-bar { padding: 10px 12px; }
  .page-title { font-size: 16px; }
  .logo-text { font-size: 16px; }
  .wallet-info { gap: 8px; font-size: 12px; }
  .avatar-circle { width: 30px; height: 30px; font-size: 14px; }
  .btn-back { padding: 4px 10px; font-size: 13px; }

  /* 主页 */
  .home-content { padding: 12px; }
  .home-menu { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .menu-btn { padding: 16px 10px; }
  .menu-icon { font-size: 28px; }
  .menu-label { font-size: 14px; }
  .menu-desc { font-size: 11px; }

  /* AI / 匹配选择 */
  .ai-select, .match-select { padding: 16px 12px; }
  .ai-select h3, .match-select h3 { font-size: 17px; margin-bottom: 16px; }
  .ai-level-btn, .room-btn { padding: 14px; gap: 10px; flex-wrap: wrap; }
  .level-name { font-size: 15px; }
  .level-desc { font-size: 12px; }
  .room-name { font-size: 15px; flex: 1 1 100%; }
  .room-stake, .room-fee, .room-pool { font-size: 12px; }

  /* 充值 */
  .recharge-content { padding: 12px; }
  .recharge-card { padding: 20px; }
  .recharge-card h3 { font-size: 17px; }

  /* NFT */
  .nft-content { padding: 12px; }
  .nft-tabs { gap: 2px; }
  .nft-tab { padding: 8px 6px; font-size: 12px; }
  .nft-panel { padding: 14px; }
  .nft-levels { grid-template-columns: 1fr 1fr; gap: 8px; }
  .nft-level-btn { padding: 12px 10px; font-size: 12px; }
  .nft-mint-header { gap: 8px; }
  .nft-mint-actions { gap: 8px; }
  .mint-subtotal { min-width: auto; font-size: 11px; }
  .nft-count-bar { gap: 8px; }
  .nft-count-tag { font-size: 11px; padding: 3px 8px; }

  /* 邀请 */
  .invite-content { padding: 12px; }
  .invite-card { padding: 16px; }
  .invite-stats { flex-wrap: wrap; gap: 8px; }
  .stat-item { padding: 10px; }
  .stat-num { font-size: 20px; }
  .invite-link-box { flex-direction: column; gap: 6px; }

  /* 社区 */
  .community-content { padding: 12px; }
  .community-card { padding: 18px; }
  .community-info-row code { font-size: 11px; }
  .community-actions .btn { font-size: 14px; padding: 10px 16px; }

  /* 排行榜 */
  .rank-content { padding: 12px; }
  .rank-header, .rank-item { font-size: 11px; padding: 10px 8px; }
  .rank-col-1 { width: 36px; }
  .rank-col-3 { width: 50px; }
  .rank-col-4 { width: 50px; }
  .rank-col-5 { width: 60px; }
  .rank-medal { font-size: 18px; }
  .rank-pos { font-size: 13px; }

  /* 设置 */
  .setting-content { padding: 12px; }
  .setting-item { padding: 12px 0; font-size: 14px; }

  /* 游戏棋盘 */
  .game-layout {
    flex-direction: column; align-items: center; gap: 8px; padding: 8px;
  }
  .game-left, .game-right { width: 100%; }
  .game-left {
    display: flex; gap: 6px; align-items: center;
  }
  .game-left .player-info {
    flex: 1; padding: 10px 8px; margin-bottom: 0;
  }
  .player-avatar { font-size: 30px; }
  .player-detail { margin-top: 4px; font-size: 13px; }
  .player-badge { font-size: 10px; }
  .game-score { font-size: 18px; margin: 4px 0; }
  .game-right {
    width: 100%;
  }
  .move-history { max-height: 160px; }
  .move-history h4 { font-size: 13px; }
  .move-item { font-size: 12px; }
  #game-canvas { width: 100%; height: auto; }
  .game-status { font-size: 14px; margin-top: 8px; }

  /* 匹配等待 */
  .matchmaking-content { padding-top: 40px; }
  .matchmaking-content h3 { font-size: 17px; }

  /* 弹窗 */
  .modal-content { min-width: auto; width: calc(100% - 40px); padding: 24px 20px; }
  .modal-content h2 { font-size: 20px; }

  /* 按钮 */
  .btn { padding: 10px 18px; font-size: 14px; }
  .btn-small { padding: 5px 10px; font-size: 12px; }

  /* NFT 额外 */
  .nft-card-actions { flex-direction: column; align-items: center; }
  .nft-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .nft-item-right { width: 100%; justify-content: space-between; }

  /* 销毁 */
  .burn-select-item { flex-direction: column; gap: 8px; align-items: flex-start; }
  .burn-select-right { width: 100%; justify-content: space-between; }
}

/* ==================== 横屏适配（手机竖屏→横屏时优化显示） ==================== */
@media (orientation: landscape) and (max-height: 500px) {
  /* 通用：页面内容紧凑 */
  .top-bar { padding: 6px 12px; }
  .page-title { font-size: 14px; }
  .wallet-info { gap: 6px; font-size: 11px; }
  .avatar-circle { width: 26px; height: 26px; font-size: 12px; }
  .btn-back { padding: 3px 8px; font-size: 12px; }

  /* 主页菜单缩小 */
  .home-content { padding: 6px 12px; }
  .home-menu { gap: 6px; }
  .menu-btn { padding: 10px 8px; }
  .menu-icon { font-size: 22px; }
  .menu-label { font-size: 12px; }
  .menu-desc { display: none; }

  /* 游戏棋盘：让 canvas 自适应高度 */
  .game-layout { flex-direction: row !important; gap: 6px; padding: 4px 8px; align-items: stretch; }
  .game-left { width: auto !important; min-width: 100px; flex-shrink: 0; }
  .game-left .player-info { padding: 6px 8px; margin-bottom: 4px; }
  .player-avatar { font-size: 20px; }
  .player-detail { margin-top: 2px; font-size: 11px; }
  .game-score { font-size: 14px; margin: 2px 0; }
  .game-center { flex: 1; min-width: 0; }
  #game-canvas { max-height: calc(100vh - 60px); width: auto !important; max-width: 100% !important; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  .game-status { font-size: 12px; margin-top: 4px; }
  .game-timer-bar { font-size: 14px; min-height: 20px; margin-top: 2px; }
  .game-btn-row { margin-top: 4px; gap: 6px; }
  .game-right { display: none; }  /* 横屏隐藏走子记录，腾空间 */

  /* AI/匹配选择页 */
  .ai-select, .match-select { padding: 8px 12px; }
  .ai-select h3, .match-select h3 { font-size: 14px; margin-bottom: 8px; }
  .ai-level-btn, .room-btn { padding: 8px 12px; gap: 6px; }
  .level-name { font-size: 13px; }
  .level-desc { font-size: 11px; }
  .room-stake, .room-fee, .room-pool { font-size: 11px; }

  /* NFT 页 */
  .nft-content { padding: 6px 12px; }
  .nft-panel { padding: 10px; }
  .nft-tab { padding: 5px 4px; font-size: 11px; }
  .nft-levels { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .nft-level-btn { padding: 6px 6px; font-size: 11px; }
  .nft-card { padding: 10px; }
  .nft-card-icon { font-size: 28px; }

  /* 邀请页 */
  .invite-content { padding: 6px 12px; }
  .invite-card { padding: 14px; }
  .invite-stats { gap: 4px; }
  .stat-item { padding: 6px; }
  .stat-num { font-size: 16px; }

  /* 充值 */
  .recharge-content { padding: 6px 12px; }
  .recharge-card { padding: 14px; }

  /* 排行榜 */
  .rank-content { padding: 6px 12px; }
  .rank-header, .rank-item { font-size: 10px; padding: 6px 4px; }

  /* 社区 */
  .community-content { padding: 6px 12px; }
  .community-card { padding: 14px; }

  /* 设置 */
  .setting-content { padding: 6px 12px; }
  .setting-item { padding: 8px 0; font-size: 13px; }

  /* 匹配等待 */
  .matchmaking-content { padding-top: 20px; }
  .matchmaking-content h3 { font-size: 15px; }
  .spinner { width: 36px; height: 36px; margin-bottom: 10px; }
}

@media (orientation: landscape) and (min-height: 501px) and (max-height: 767px) {
  /* 中等高度横屏：iPad 横屏等 */
  .game-layout { flex-direction: row !important; gap: 8px; }
  .game-left { width: auto !important; min-width: 120px; }
  .game-right { max-width: 140px; }
  .game-right { display: none; }
  .nft-levels { grid-template-columns: repeat(4, 1fr); }
}

/* 隐藏主页右上角紫色头像圆圈 */
#home-avatar { display: none !important; }
