/* ========== 澳洲8番摊 H5 深色主题 ========== */
:root {
  --bg-primary: #0d0d1a;
  --bg-secondary: #16213e;
  --bg-card: rgba(255,255,255,0.06);
  --bg-card-hover: rgba(255,255,255,0.1);
  --gold: #ffd700;
  --gold-dark: #ffb300;
  --red: #ff4757;
  --green: #2ed573;
  --blue: #3742fa;
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.65);
  --text-muted: rgba(255,255,255,0.4);
  --border: rgba(255,255,255,0.1);
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
input, button, select, textarea { font-family: inherit; outline: none; }

/* ===== 顶部栏 ===== */
.topbar {
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--border);
}
.topbar .icon-back { font-size: 14px; cursor: pointer; color: var(--gold); white-space: nowrap; font-weight: 600; }
.topbar .title { flex: 1; text-align: center; font-size: 17px; font-weight: 600; color: #fff; }
.topbar .icon { font-size: 20px; color: var(--gold); cursor: pointer; }

/* ===== 期号区域 ===== */
.period-bar {
  background: linear-gradient(135deg, #1a1a3e, #16213e);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.period-bar .period-no { font-weight: 700; font-size: 14px; color: var(--gold); }
.period-bar .balls { display: flex; gap: 3px; flex: 1; margin: 0 10px; flex-wrap: wrap; }
.ball {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.ball.red, .ball.b2 { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }
.ball.green, .ball.b4 { background: linear-gradient(135deg, #2ed573, #1abc9c); }
.ball.yellow, .ball.b3 { background: linear-gradient(135deg, #ffd32a, #feca57); color: #333; }
.ball.blue, .ball.b1 { background: linear-gradient(135deg, #48dbfb, #0abde3); }
.period-bar .countdown {
  background: var(--gold-dark); color: #1a1a2e;
  padding: 4px 12px; border-radius: 20px; font-size: 13px;
  min-width: 56px; text-align: center; font-weight: 700;
  letter-spacing: 1px;
}

/* ===== 余额栏 ===== */
.user-bar {
  background: var(--bg-card);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.user-bar .name { color: #fff; font-weight: 600; }
.user-bar .balance { color: var(--gold); font-weight: 700; font-size: 16px; }

/* ===== 卡片 ===== */
.card {
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(198,40,40,0.1));
  border: 1px solid rgba(255,215,0,0.15);
  color: #fff;
  padding: 20px;
  border-radius: var(--radius);
  margin: 8px;
  box-shadow: var(--shadow);
}
.card .label { font-size: 12px; opacity: 0.7; }
.card .value { font-size: 28px; font-weight: 700; margin-top: 4px; color: var(--gold); }

/* ===== 通用 Section ===== */
.section, .trend-section, .road-section, .bet-list, .chat-section {
  background: var(--bg-card);
  margin: 8px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.section h3, .trend-section h3, .road-section h3, .bet-list h3, .chat-section h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--gold);
}

/* ===== 走势表格 ===== */
.trend-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.trend-table th, .trend-table td {
  padding: 5px 2px;
  text-align: center;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.trend-table th { background: rgba(255,215,0,0.1); color: var(--gold); }
.trend-ball {
  display: inline-block;
  width: 22px; height: 22px;
  border-radius: 50%;
  text-align: center;
  line-height: 22px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.trend-ball.b1 { background: linear-gradient(135deg, #48dbfb, #0abde3); }
.trend-ball.b2 { background: linear-gradient(135deg, #ff6b6b, #ee5a24); }
.trend-ball.b3 { background: linear-gradient(135deg, #ffd32a, #feca57); color: #333; }
.trend-ball.b4 { background: linear-gradient(135deg, #2ed573, #1abc9c); }

/* ===== 路单 ===== */
.road-row { display: flex; gap: 4px; margin: 4px 0; font-size: 11px; }
.road-cell {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-weight: 700;
}
.road-cell.big { background: rgba(255,71,87,0.15); color: var(--red); border: 1px solid rgba(255,71,87,0.3); }
.road-cell.small { background: rgba(72,219,251,0.15); color: #0abde3; border: 1px solid rgba(72,219,251,0.3); }
.road-cell.odd { background: rgba(255,159,67,0.15); color: #ff9f43; border: 1px solid rgba(255,159,67,0.3); }
.road-cell.even { background: rgba(55,66,250,0.15); color: #5352ed; border: 1px solid rgba(55,66,250,0.3); }

/* ===== 聊天区 ===== */
.chat-section {
  flex: 1 1 0;
  min-height: 0;
  margin: 4px 8px 4px !important;
  padding: 12px 14px 8px !important;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.chat-section h3 { margin: 0 0 8px 0; flex-shrink: 0; }
#chatMessages { flex: 1 1 0; min-height: 0; overflow-y: auto; }
.chat-msg { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-start; }
.chat-msg .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 600;
}
.chat-msg .avatar.bot { background: linear-gradient(135deg, #48dbfb, #0abde3); }
.chat-msg .body { flex: 1; min-width: 0; }
.chat-msg .name { font-size: 12px; color: var(--gold); font-weight: 600; }
.chat-msg .bubble {
  background: rgba(255,255,255,0.08);
  padding: 8px 12px;
  border-radius: 12px 12px 12px 4px;
  margin-top: 3px;
  font-size: 13px;
  display: inline-block;
  word-break: break-all;
  max-width: 240px;
  color: #fff;
}
.chat-msg.me .bubble { background: rgba(46,213,115,0.2); border-radius: 12px 12px 4px 12px; }
.chat-msg.bot .bubble { background: rgba(72,219,251,0.15); }
.chat-msg.system .bubble { background: rgba(255,215,0,0.1); color: var(--gold); }
.chat-msg.win .bubble { background: rgba(46,213,115,0.2); color: var(--green); }

/* ===== 底部导航 ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  display: flex;
  border-top: 1px solid var(--border);
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
  max-width: 500px;
  margin: 0 auto;
}
.bottom-nav .nav-item {
  flex: 1; text-align: center; padding: 8px 0 6px;
  color: var(--text-muted); font-size: 11px; cursor: pointer;
  transition: color 0.2s;
}
.bottom-nav .nav-item.active { color: var(--gold); }
.bottom-nav .nav-item .nav-icon { font-size: 20px; display: block; margin-bottom: 2px; }

/* ===== 登录/注册页 ===== */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1a1a3e 0%, #0d0d1a 60%, #050510 100%);
}
.login-page .logo {
  font-size: 36px;
  color: var(--gold);
  font-weight: 800;
  margin-bottom: 8px;
  text-shadow: 0 2px 20px rgba(255,215,0,0.4);
  letter-spacing: 2px;
}
.login-page .subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 36px; letter-spacing: 1px; }
.login-page .form-item { width: 100%; margin-bottom: 14px; }
.login-page input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  transition: all 0.2s;
}
.login-page input::placeholder { color: var(--text-muted); }
.login-page input:focus { border-color: var(--gold); background: rgba(255,255,255,0.12); box-shadow: 0 0 0 3px rgba(255,215,0,0.1); }
.login-page .btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1a2e;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(255,215,0,0.3);
}
.login-page .btn:active { transform: scale(0.98); }
.login-page .btn-secondary {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid var(--border);
  box-shadow: none;
}
.login-page .links {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.login-page .links span { cursor: pointer; transition: color 0.2s; }
.login-page .links span:hover { color: var(--gold); }
.login-page .err { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ===== 账户中心 ===== */
.list-item {
  background: var(--bg-card);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s;
}
.list-item:active { background: var(--bg-card-hover); }
.list-item .label { color: var(--text-secondary); }
.list-item .value { font-weight: 600; color: #fff; }
.list-item .arrow { color: var(--text-muted); }

/* ===== 表单 ===== */
.wallet-form { padding: 12px; }
.wallet-form .form-item { margin-bottom: 12px; }
.wallet-form input, .wallet-form select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  transition: all 0.2s;
}
.wallet-form input::placeholder { color: var(--text-muted); }
.wallet-form input:focus, .wallet-form select:focus { border-color: var(--gold); background: rgba(255,255,255,0.12); }
.wallet-form select option { background: var(--bg-secondary); color: #fff; }
.wallet-form button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1a2e;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.15s;
  box-shadow: 0 4px 16px rgba(255,215,0,0.2);
}
.wallet-form button:active { transform: scale(0.98); }

/* ===== 表格 ===== */
.record-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.record-table th { background: rgba(255,215,0,0.1); color: var(--gold); padding: 10px 6px; text-align: left; font-weight: 600; }
.record-table td { padding: 10px 6px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.record-table .win { color: var(--green); font-weight: 600; }
.record-table .lose { color: var(--text-muted); }
.record-table .pending { color: #ff9f43; }

/* ===== 通用按钮 ===== */
.btn {
  display: inline-block;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1a2e;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(255,215,0,0.2);
}
.btn:active { transform: scale(0.98); }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 60px 0; color: var(--text-muted); font-size: 14px; }

/* ===== Badge ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-gray { background: rgba(255,255,255,0.1); color: var(--text-secondary); }
.badge-green { background: rgba(46,213,115,0.2); color: var(--green); }
.badge-red { background: rgba(255,71,87,0.2); color: var(--red); }
.badge-orange { background: rgba(255,159,67,0.2); color: #ff9f43; }
.badge-blue { background: rgba(72,219,251,0.2); color: #0abde3; }

/* ===== 页面容器 ===== */
.page-container { padding: 0 0 60px; min-height: calc(100vh - 48px); }

/* ===== 加载动画 ===== */
.loading-dots { text-align: center; padding: 20px; color: var(--text-muted); font-size: 13px; }
.loading-dots span { display: inline-block; animation: dot 1.4s infinite; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 0%,80%,100% { opacity: 0.2; } 40% { opacity: 1; } }

/* ===== 动画 ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes ballDrop {
  0% { transform: translateY(-30px) scale(0.5); opacity: 0; }
  60% { transform: translateY(4px) scale(1.1); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
