:root {
  --bg: #0f1218;
  --surface: #1a1f2b;
  --surface-2: #232a3a;
  --border: rgba(255,255,255,.06);
  --text: #f2f4f8;
  --text-dim: #8b93a7;
  --blue: #3d7bfd;
  --blue-deep: #2563eb;
  --green: #3ecf8e;
  --gold: #f5c453;
  --red: #f27a6a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font-family: inherit; }
body { max-width: 480px; margin: 0 auto; position: relative; overflow-x: hidden; }

#app { display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
#header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; position: sticky; top: 0; z-index: 100;
  background: var(--bg);
}
.header-back { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 18px; background: var(--surface); font-size: 18px; display: none; }
.header-center { flex: 1; display: flex; justify-content: center; }
.header-right { display: flex; align-items: center; }
.pill { padding: 4px 12px; border-radius: 16px; background: var(--surface); font-size: 13px; }
.pill-title { font-weight: 600; }
.pill-lang { font-size: 12px; color: var(--text-dim); }

/* Main */
#main { flex: 1; padding: 12px 14px 80px; overflow-y: auto; }

/* Bottom nav */
#nav {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  display: flex; background: var(--surface); border-top: 1px solid var(--border); z-index: 100;
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 0; font-size: 11px; color: var(--text-dim); }
.nav-item.active { color: var(--blue); }
.nav-icon { font-size: 20px; margin-bottom: 2px; }

/* Cards */
.card {
  background: var(--surface); border-radius: 20px; padding: 16px; margin-bottom: 12px;
  border: 1px solid var(--border);
}

/* Balance grid */
.balance-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px;
}
.balance-item {
  background: var(--surface); border-radius: 16px; padding: 12px 8px; text-align: center;
  border: 1px solid var(--border);
}
.balance-item.total { grid-column: span 3; background: linear-gradient(135deg, var(--blue-deep), var(--blue)); }
.balance-label { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.balance-item.total .balance-label { color: rgba(255,255,255,0.8); }
.balance-value { font-size: 18px; font-weight: 700; color: var(--gold); }
.balance-item.total .balance-value { font-size: 24px; color: #fff; }
.action-buttons { display: flex; gap: 8px; margin-bottom: 12px; }
.flex-1 { flex: 1; }

/* Buttons */
.btn {
  width: 100%; height: 52px; border-radius: 14px; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; margin-bottom: 8px;
}
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-deep)); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text-dim); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { height: 36px; font-size: 13px; border-radius: 10px; padding: 0 16px; }

/* Room list */
.room-card { display: flex; align-items: center; padding: 14px 16px; }
.room-info { flex: 1; }
.room-name { font-weight: 600; margin-bottom: 4px; }
.room-meta { font-size: 12px; color: var(--text-dim); }
.room-btn { padding: 8px 20px; border-radius: 12px; background: var(--blue); color: #fff; font-size: 14px; }

/* Lobby */
.promo-banner {
  background: linear-gradient(135deg, #1a1f4b, #0f1218); border-radius: 20px; padding: 20px;
  margin-bottom: 16px; border: 1px solid var(--border);
}
.promo-banner h2 { font-size: 20px; margin-bottom: 4px; }
.promo-banner p { font-size: 13px; color: var(--text-dim); }

/* Wallet */
.balance-card { text-align: center; padding: 24px; }
.balance-total { font-size: 32px; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.balance-detail { font-size: 13px; color: var(--text-dim); display: flex; justify-content: center; gap: 16px; }

/* Profile */
.profile-card { text-align: center; padding: 20px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--surface-2); margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; font-size: 32px; }
.profile-name { font-weight: 600; margin-bottom: 4px; }
.profile-uid { font-size: 12px; color: var(--text-dim); }
.menu-list { margin-top: 16px; }
.menu-item { padding: 14px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.menu-item:last-child { border-bottom: none; }
.menu-right { color: var(--text-dim); font-size: 13px; }

/* Toast */
#toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.85); color: #fff; padding: 10px 20px; border-radius: 12px;
  font-size: 14px; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }

/* Modal */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 150; display: none;
  align-items: center; justify-content: center; padding: 24px;
}
#modal-overlay.show { display: flex; }
.modal { background: var(--surface); border-radius: 20px; padding: 24px; width: 100%; max-width: 340px; }
.modal h3 { margin-bottom: 16px; }
.modal-input { width: 100%; height: 48px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 0 14px; color: var(--text); font-size: 16px; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* Leaderboard */
.rank-item { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rank-item:last-child { border-bottom: none; }
.rank-num { width: 32px; text-align: center; font-weight: 700; }
.rank-num.top-1 { color: var(--gold); }
.rank-num.top-2 { color: #c0c0c0; }
.rank-num.top-3 { color: #cd7f32; }
.rank-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); margin-right: 10px; }
.rank-info { flex: 1; }
.rank-name { font-weight: 500; }
.rank-score { font-size: 12px; color: var(--gold); }

/* Game room */
.game-table {
  background: linear-gradient(180deg, #1a3a1a 0%, #0f1a0f 100%); border-radius: 24px;
  padding: 20px; margin-bottom: 12px; min-height: 280px; position: relative;
}
.seat {
  position: absolute; display: flex; flex-direction: column; align-items: center;
  width: 90px;
}
.seat-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.seat-name { font-size: 11px; margin-top: 4px; }
.seat-cards { display: flex; gap: 2px; margin-top: 4px; }
.card-sm {
  width: 24px; height: 36px; background: #fff; border-radius: 4px;
  display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: #333;
}
.card-sm.red { color: #d32f2f; }
.game-info {
  text-align: center; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.7); padding: 10px 16px; border-radius: 14px;
}
.pot { font-size: 20px; color: var(--gold); font-weight: 700; }
.timer { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.action-bar { display: flex; gap: 6px; margin-bottom: 8px; }
.action-bar .btn { flex: 1; font-size: 14px; }
.my-cards { display: flex; gap: 4px; justify-content: center; margin: 12px 0; }
.card-lg {
  width: 60px; height: 90px; background: #fff; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: #333;
}
.card-lg.red { color: #d32f2f; }
.card-lg.hidden { background: var(--surface-2); color: transparent; border: 1px solid var(--border); }

/* Referral */
.referral-code {
  text-align: center; padding: 24px; background: linear-gradient(135deg, var(--blue-deep), var(--blue));
  border-radius: 20px; margin-bottom: 16px;
}
.referral-code h2 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat-card { background: var(--surface-2); border-radius: 14px; padding: 12px; text-align: center; }
.stat-val { font-size: 18px; font-weight: 700; color: var(--gold); }
.stat-label { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Transactions */
.tx-item {
  display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.tx-item:last-child { border-bottom: none; }
.tx-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); margin-right: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.tx-info { flex: 1; }
.tx-type { font-weight: 500; font-size: 14px; }
.tx-note { font-size: 11px; color: var(--text-dim); }
.tx-amount { font-weight: 600; }
.tx-amount.positive { color: var(--green); }
.tx-amount.negative { color: var(--red); }

/* Settings */
.settings-group { margin-bottom: 16px; }
.settings-group-title { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; padding-left: 4px; }
.settings-item { padding: 14px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.settings-item:last-child { border-bottom: none; }
.toggle { width: 44px; height: 26px; border-radius: 13px; background: var(--surface-2); position: relative; }
.toggle.on { background: var(--blue); }
.toggle::after {
  content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  top: 3px; left: 3px; transition: transform .2s;
}
.toggle.on::after { transform: translateX(18px); }

.radio-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); position: relative; flex-shrink: 0; }
.radio-dot.checked { border-color: var(--blue); }
.radio-dot.checked::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--blue); }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-dim); }
.loading-spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid var(--surface-2); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Demo toast */
.demo-toast {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff; padding: 8px 16px; border-radius: 10px;
  font-size: 12px; z-index: 150; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.demo-toast.show { opacity: 1; }

/* Chatroom - game happens inside normal chat group */
.chat-room { display: flex; flex-direction: column; height: 100%; }

.chat-header {
  background: #16181f; padding: 10px 12px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.chat-header-left { display: flex; flex-direction: column; gap: 2px; }
.chat-header-name { font-size: 14px; font-weight: 600; color: #f2f4f8; }
.chat-header-sub { font-size: 11px; color: #6b7280; }
.chat-header-right { }
.chat-header-round { font-size: 11px; color: #f5c453; }

.chat-body {
  flex: 1; overflow-y: auto; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}

.msg { max-width: 85%; }
.msg.other { align-self: flex-start; }
.msg.mine { align-self: flex-end; }
.msg.system { align-self: center; max-width: 100%; }

 .msg-system-text {
   font-size: 11px; color: #d1d5db; padding: 4px 10px;
   background: rgba(55,65,81,0.3); border-radius: 10px; display: inline-block;
 }

.msg-bubble { padding: 8px 12px; border-radius: 12px; }
.msg-name { font-size: 11px; color: #3d7bfd; margin-bottom: 2px; }
.msg-text { font-size: 13px; color: #f2f4f8; word-break: break-word; }
.msg.mine .msg-bubble { background: #3d7bfd; }
.msg.other .msg-bubble { background: #1a1f2b; }
.msg-time { font-size: 9px; opacity: 0.5; text-align: right; margin-top: 2px; color: inherit; }

/* TNG red packet message */
.msg.red-packet { flex-direction: column; align-items: center; }
.tng-link {
  margin-top: 6px; padding: 10px 16px; background: linear-gradient(135deg, #e63946, #c1121f);
  border-radius: 10px; display: flex; flex-direction: column; gap: 2px;
  max-width: 240px; width: 100%;
}
.tng-label { font-size: 11px; color: rgba(255,255,255,0.7); }
.tng-code { font-size: 16px; font-weight: 700; color: #ffd700; font-family: monospace; }
.tng-hint { font-size: 10px; color: rgba(255,255,255,0.6); }

.chat-footer {
  padding: 8px 12px; display: flex; gap: 8px; align-items: center;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.chat-footer input {
  flex: 1; height: 38px; border-radius: 19px; padding: 0 14px;
  background: #1a1f2b; border: 1px solid rgba(255,255,255,0.06);
  color: #f2f4f8; font-size: 14px;
}
.chat-footer input:focus { outline: none; border-color: #3d7bfd; }
.chat-send {
  height: 38px; padding: 0 18px; border-radius: 19px;
  background: #3d7bfd; color: #fff; font-size: 14px; font-weight: 600;
  border: none; cursor: pointer;
}
.room-header { padding: 8px 4px; }
.room-title-row { display: flex; justify-content: space-between; align-items: center; }
.room-badge { background: var(--blue-deep); color: #fff; padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 600; }
.room-meta-row { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--text-dim); }
.room-meta-row span:last-child { color: var(--gold); font-weight: 600; }

/* Player bar */
.player-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 4px; }
.player-bar #player-list { display: flex; flex-wrap: wrap; gap: 4px; }
.player-chip { background: var(--surface-2); border-radius: 10px; padding: 3px 8px; font-size: 10px; display: flex; align-items: center; gap: 4px; }
.player-chip.me { border: 1px solid var(--blue); }
.player-chip.dealer { border: 1px solid var(--gold); }
.player-chip .score { color: var(--gold); font-size: 9px; }
.player-chip .turn-dot { color: var(--green); font-size: 12px; }
.hand-badge { background: var(--red); color: #fff; padding: 1px 4px; border-radius: 4px; font-size: 8px; }
.dealer-badge { background: var(--gold); color: #333; padding: 2px 8px; border-radius: 8px; font-size: 10px; font-weight: 600; }

/* Game table - green felt with 6 seats */
.game-table {
  position: relative; height: 280px; margin: 8px 0;
  background: radial-gradient(ellipse at center, #1a5c36 0%, #0d3320 60%, #0a2618 100%);
  border-radius: 140px; border: 3px solid #2d1a0e;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.5), 0 4px 20px rgba(0,0,0,0.4);
}
.table-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center;
}
.pot-display { background: rgba(0,0,0,0.4); padding: 6px 14px; border-radius: 12px; }
.pot-label { font-size: 10px; color: #ffd700; display: block; }
.pot-amount { font-size: 16px; font-weight: 700; color: #ffd700; }

/* 6 seats around the table */
.seat {
  position: absolute; width: 80px; display: flex; flex-direction: column; align-items: center;
}
.seat-top-left { top: -20px; left: 20px; }
.seat-top { top: -25px; left: 50%; transform: translateX(-50%); }
.seat-top-right { top: -20px; right: 20px; }
.seat-bottom-left { bottom: 10px; left: 15px; }
.seat-bottom-right { bottom: 10px; right: 15px; }
.seat-bottom { bottom: 5px; left: 50%; transform: translateX(-50%); }

.seat-empty {
  font-size: 10px; color: rgba(255,255,255,0.3); padding: 8px 12px;
  border-radius: 12px; background: rgba(0,0,0,0.2);
}
.seat-player {
  background: rgba(15,18,24,0.85); padding: 6px 8px; border-radius: 12px;
  text-align: center; min-width: 70px; border: 1px solid rgba(255,255,255,0.1);
}
.seat-player.dealer { border-color: var(--gold); box-shadow: 0 0 10px rgba(245,196,83,0.3); }
.seat-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--blue);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 4px;
  font-weight: 700; font-size: 14px; color: #fff;
}
.seat-name { font-size: 10px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70px; }
.seat-balance { font-size: 9px; color: var(--gold); }
.seat-dice { display: flex; gap: 2px; justify-content: center; margin-top: 3px; }
.seat-hand { font-size: 9px; color: var(--red); font-weight: 600; margin-top: 1px; }
.seat-points { font-size: 9px; color: var(--green); }
.seat-bet { font-size: 8px; color: var(--blue); margin-top: 1px; }

/* Player's hand area */
.my-hand-area {
  background: var(--surface); border-radius: 16px; padding: 10px; margin: 8px 0;
  display: flex; align-items: center; gap: 12px;
}
.my-hand-label { font-size: 12px; color: var(--text-dim); flex-shrink: 0; }
.my-dice { display: flex; gap: 4px; flex: 1; justify-content: center; }
.my-hand-result { font-size: 12px; flex-shrink: 0; }
.hand-type { color: var(--red); font-weight: 700; }
.hand-points { color: var(--green); }

/* Action bar */
.action-bar {
  display: flex; gap: 6px; margin: 6px 0;
}
.action-bar .btn { flex: 1; height: 38px; border-radius: 10px; font-size: 13px; font-weight: 600; }

/* Chat area */
.chat-area {
  background: var(--surface); border-radius: 16px; padding: 8px;
  max-height: 180px; display: flex; flex-direction: column;
}
.chat-messages {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 4px 0;
}
.chat-msg { font-size: 12px; }
.chat-msg.system {
  color: #6b7280; font-size: 10px; text-align: center; padding: 4px 0;
}
.chat-msg:not(.system):not(.red-packet) {
  padding: 6px 10px; background: var(--surface-2); border-radius: 10px 10px 10px 2px;
  max-width: 75%;
}
.chat-msg.mine { align-self: flex-end; background: var(--blue-deep); border-radius: 10px 10px 2px 10px; }
.chat-name { color: var(--blue); font-weight: 500; font-size: 10px; display: block; margin-bottom: 1px; }
.chat-text { color: var(--text); }

/* Red packet in chat */
.chat-msg.red-packet { max-width: 200px; margin: 2px 0; }
.red-packet-box {
  background: linear-gradient(180deg, #e63946, #c1121f);
  border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 8px;
  border: 1px solid #ff6b6b; cursor: pointer; position: relative; overflow: hidden;
}
.red-packet-box::before {
  content: ''; position: absolute; top: -50%; right: -50%; width: 100%; height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}
.red-packet-box:active { transform: scale(0.97); }
.red-packet-icon { font-size: 28px; position: relative; z-index: 1; }
.red-packet-info { flex: 1; position: relative; z-index: 1; }
.red-packet-title { color: #fff; font-size: 11px; font-weight: 600; }
.red-packet-sender { color: rgba(255,255,255,0.7); font-size: 9px; }
.red-packet-btn {
  background: linear-gradient(180deg, #ffd700, #ffaa00);
  color: #1a1f2b; padding: 5px 12px; border-radius: 8px;
  font-size: 11px; font-weight: 700; border: none; cursor: pointer;
  position: relative; z-index: 1;
}
.red-packet-btn:hover { transform: scale(1.05); }
.red-packet-btn:active { transform: scale(0.95); }

/* Chat input */
.chat-input-row { display: flex; gap: 6px; margin-top: 6px; }
.btn-icon { width: 36px; height: 36px; border-radius: 10px; background: #ff4444; font-size: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-input-row input {
  flex: 1; height: 36px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--border); padding: 0 10px; color: var(--text); font-size: 13px;
}
.chat-input-row input:focus { outline: none; border-color: var(--blue); }
.chat-input-row .btn-sm { width: 50px; height: 36px; border-radius: 10px; background: var(--blue); color: #fff; font-size: 12px; font-weight: 600; flex-shrink: 0; }

/* Chatroom - Telegram style */
.chatroom { flex: 1; overflow-y: auto; min-height: 200px; max-height: 50vh; }
.messages { padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.msg { font-size: 13px; line-height: 1.4; }

/* System messages */
.msg.system {
  color: #6b7280; font-size: 11px; text-align: center; padding: 6px 0;
}

/* Chat messages - left side (others) */
.msg.chat {
  padding: 8px 12px; background: #1a1f2b; border-radius: 12px 12px 12px 2px;
  align-self: flex-start; max-width: 75%; position: relative;
}
.msg.chat .name { color: #3d7bfd; font-weight: 500; font-size: 12px; display: block; margin-bottom: 2px; }
.msg.chat .text { color: #f2f4f8; }

/* My messages - right side */
.msg.chat.mine {
  background: #2563eb; border-radius: 12px 12px 2px 12px;
  align-self: flex-end;
}
.msg.chat.mine .name { color: #93c5fd; }
.msg.chat.mine .text { color: #fff; }

/* Red packet - TNG style */
.msg.red-packet { align-self: flex-start; max-width: 220px; }
.msg.red-packet.mine { align-self: flex-end; }
.packet-container {
  background: linear-gradient(180deg, #e63946 0%, #c1121f 100%);
  border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid #ff6b6b; position: relative; overflow: hidden;
}
.packet-container::before {
  content: ''; position: absolute; top: -50%; right: -50%; width: 100%; height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}
.packet-container:hover { transform: scale(1.03); box-shadow: 0 4px 15px rgba(230, 57, 70, 0.4); }
.packet-container:active { transform: scale(0.97); }
.packet-container[data-claimed="true"] { background: linear-gradient(180deg, #495057 0%, #343a40 100%); border-color: #6c757d; }

.packet-icon { font-size: 36px; position: relative; z-index: 1; }
.packet-info { flex: 1; position: relative; z-index: 1; }
.packet-sender { color: rgba(255,255,255,0.85); font-size: 10px; display: flex; align-items: center; gap: 4px; }
.packet-sender .type { background: rgba(255,255,255,0.2); padding: 1px 4px; border-radius: 4px; font-size: 8px; }
.packet-amount { color: #ffd700; font-size: 18px; font-weight: 700; margin-top: 2px; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.packet-time { color: rgba(255,255,255,0.5); font-size: 9px; margin-top: 1px; }

/* Prize packet - different style */
.packet-container.prize {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  border-color: #fbbf24;
}
.packet-container.prize:hover { box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4); }

/* Claim button */
.packet-btn {
  background: linear-gradient(180deg, #ffd700, #ffaa00);
  color: #1a1f2b; padding: 6px 14px; border-radius: 10px;
  font-size: 11px; font-weight: 700; cursor: pointer; border: none;
  box-shadow: 0 2px 6px rgba(255, 170, 0, 0.3); transition: transform 0.1s;
}
.packet-btn:hover { transform: scale(1.05); }
.packet-btn:active { transform: scale(0.95); }

/* Input area */
.input-area { padding: 8px 4px; }
.action-row { display: flex; gap: 4px; margin-bottom: 6px; }
.action-btn { flex: 1; height: 36px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--blue); color: #fff; }
.action-btn.small { flex: 0.7; background: var(--surface-2); color: var(--text-dim); }
.action-btn:hover { opacity: 0.9; }
.input-row { display: flex; gap: 6px; }
.input-row input {
  flex: 1; height: 40px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--border); padding: 0 12px; color: var(--text); font-size: 14px;
}
.input-row input:focus { outline: none; border-color: var(--blue); }
.input-row button { padding: 0 16px; height: 40px; border-radius: 12px; background: var(--blue); color: #fff; font-size: 14px; font-weight: 600; }
.packet-btn-icon { width: 40px; height: 40px; border-radius: 12px; background: #ff4444; color: #fff; font-size: 20px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Red packet modal */
.packet-modal { margin-top: 10px; }
.packet-modal p { margin-bottom: 10px; color: var(--text-dim); font-size: 13px; }
.packet-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.packet-option { flex: 1; min-width: 70px; padding: 8px; border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 13px; border: 1px solid var(--border); cursor: pointer; }
.packet-option:hover, .packet-option.selected { background: var(--red); color: #fff; border-color: var(--red); }
.packet-modal input { width: 100%; height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); padding: 0 12px; color: var(--text); font-size: 14px; }
.packet-modal input:focus { outline: none; border-color: var(--blue); }

/* --- 功夫牛牛平台 Custom UI Styles (Matches Screenshots) --- */
.lobby-container { padding: 12px 14px; display: flex; flex-direction: column; gap: 16px; }

/* Announcement Section */
.announcement-section { background: #131722; border-radius: 16px; padding: 12px 14px; border: 1px solid #232a3b; }
.announcement-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: #f1f5f9; }
.announcement-page { color: #94a3b8; font-size: 11px; }

.promo-banner {
  background: linear-gradient(135deg, #4c0519 0%, #881337 50%, #9f1239 100%);
  border-radius: 14px; padding: 16px; border: 1px solid #f43f5e; box-shadow: 0 4px 20px rgba(159, 18, 57, 0.4);
}
.promo-badge { display: inline-block; background: rgba(255,255,255,0.15); color: #fde047; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; margin-bottom: 6px; letter-spacing: 0.5px; }
.promo-heading { font-size: 22px; font-weight: 800; color: #ffffff; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.promo-subheading { font-size: 12px; color: #fef08a; margin: 2px 0; }
.promo-highlight { font-size: 32px; font-weight: 900; color: #facc15; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.promo-pills { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.promo-pills span { background: rgba(0,0,0,0.4); color: #fff; font-size: 10px; padding: 4px 8px; border-radius: 20px; }

.banner-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.banner-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: #334155; }
.banner-dots .dot.active { width: 16px; border-radius: 3px; background: #38bdf8; }

/* Games Section */
.games-section { display: flex; flex-direction: column; gap: 10px; }
.section-title-row { display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; color: #f8fafc; }
.section-count { font-size: 11px; background: #334155; padding: 2px 8px; border-radius: 10px; color: #94a3b8; }

.game-main-card {
  background: #1e1e1e;
  border-radius: 12px; border: none; display: flex; flex-direction: column;
  position: relative; cursor: pointer; transition: transform 0.2s; overflow: hidden;
}
.game-main-card:hover { transform: translateY(-2px); }
.game-card-image-placeholder {
  background: linear-gradient(145deg, #0f0f0f 0%, #1a1a1a 100%);
  padding: 30px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-bottom: 1px solid #333;
}
.game-card-footer {
  background: #2a2a2a; padding: 12px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.game-card-title { font-size: 16px; font-weight: 600; color: #e5e7eb; }
.btn-rule-intro {
  width: 100%; height: 38px; border-radius: 8px; background: #374151; color: #9ca3af;
  border: none; font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Chatroom Container (IMG_9310.PNG) */
.chat-room-container { display: flex; flex-direction: column; height: calc(100vh - 60px); background: #0f172a; position: relative; }
.pinned-banner { background: #1e293b; color: #38bdf8; font-size: 11px; padding: 8px 12px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid #334155; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.floating-widgets { position: absolute; top: 40px; right: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.floating-badge { background: linear-gradient(135deg, #b45309, #d97706); color: #fff; padding: 6px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 4px; border: 1px solid #f59e0b; box-shadow: 0 4px 12px rgba(0,0,0,0.4); cursor: pointer; }

.chat-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 8px; max-width: 80%; }
.msg.other { align-self: flex-start; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar img { width: 34px; height: 34px; border-radius: 50%; background: #334155; }
.msg-content { display: flex; flex-direction: column; gap: 2px; }
.msg-name { font-size: 11px; color: #94a3b8; }
.msg-bubble { background: #1e293b; color: #f8fafc; padding: 8px 14px; border-radius: 12px; font-size: 14px; line-height: 1.4; border: 1px solid #334155; }
.msg.mine .msg-bubble { background: #2563eb; border-color: #3b82f6; }
.msg-time { font-size: 9px; color: #64748b; align-self: flex-end; }

/* Bot system messages (auction/betting/dice/settlement announcements) are multi-line
   with literal \n from server templates — must preserve line breaks. */
.msg.system-msg { max-width: 92%; align-self: center; white-space: pre-line; background: #1e293b;
  color: #cbd5e1; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.6;
  border: 1px solid #334155; }
.msg.red-packet-card { background: none; border: none; padding: 0; }

.phase-status-bar { background: #1e293b; color: #facc15; font-size: 12px; font-weight: 700; text-align: center; padding: 8px 12px; border-top: 1px solid #334155; }
.dice-throw-cta { width: 100%; margin: 0; border-radius: 0; padding: 14px; font-size: 16px; font-weight: 700;
  background: linear-gradient(135deg, #d97706, #f59e0b); border: none; color: #1a1a1a;
  animation: dice-cta-pulse 1.4s ease-in-out infinite; }
.dice-throw-cta:disabled { opacity: 0.6; animation: none; }
@keyframes dice-cta-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.5); } 50% { box-shadow: 0 0 0 8px rgba(245,158,11,0); } }
.chat-footer-bar { display: flex; gap: 8px; padding: 10px; background: #0f172a; border-top: 1px solid #1e293b; }
.chat-footer-bar input { flex: 1; height: 42px; border-radius: 20px; background: #1e293b; border: 1px solid #334155; color: #fff; padding: 0 16px; font-size: 13px; }
.chat-footer-bar input:focus { outline: none; border-color: #3b82f6; }
.chat-emoji-btn, .chat-plus-btn { width: 42px; height: 42px; border-radius: 50%; background: #1e293b; border: 1px solid #334155; color: #38bdf8; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Profile Container (IMG_9311.PNG) */
.profile-container { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.profile-header-title { font-size: 18px; font-weight: 700; text-align: center; color: #f8fafc; margin-bottom: 8px; }
.profile-user-card { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: #334155; border: 2px solid #3b82f6; }
.profile-name-row { font-size: 18px; font-weight: 700; color: #f8fafc; display: flex; align-items: center; gap: 4px; }
.profile-uid { font-size: 12px; color: #94a3b8; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card { background: #1e293b; border-radius: 14px; padding: 14px; position: relative; overflow: hidden; border: 1px solid #334155; }
.stat-title { font-size: 11px; color: #94a3b8; }
.stat-value { font-size: 24px; font-weight: 800; color: #f8fafc; margin-top: 4px; }
.stat-bg-icon { position: absolute; right: 10px; bottom: 8px; font-size: 28px; opacity: 0.15; }

.actions-card { background: #1e293b; border-radius: 16px; padding: 16px; border: 1px solid #334155; }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.action-item { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.action-icon { width: 44px; height: 44px; border-radius: 12px; background: #0f172a; display: flex; align-items: center; justify-content: center; font-size: 20px; border: 1px solid #334155; }
.action-label { font-size: 12px; color: #cbd5e1; font-weight: 500; }
.profile-version { text-align: center; color: #475569; font-size: 11px; margin-top: 10px; }

/* Chat List Page (IMG_9309.PNG) */
.chat-list-page { padding: 16px; }
.chat-list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.chat-list-title { font-size: 18px; font-weight: 700; color: #f8fafc; }
.chat-list-items { display: flex; flex-direction: column; gap: 8px; }
.chat-item { display: flex; gap: 12px; align-items: center; padding: 12px; background: #1e293b; border-radius: 14px; border: 1px solid #334155; cursor: pointer; }
.chat-avatar { width: 46px; height: 46px; border-radius: 50%; background: #0f172a; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.chat-avatar.group { background: linear-gradient(135deg, #1e3a8a, #3b82f6); }
.chat-avatar.support { background: linear-gradient(135deg, #059669, #10b981); }
.chat-info { flex: 1; }
.chat-name-row { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; color: #f8fafc; margin-bottom: 4px; }
.badge-verified { color: #38bdf8; font-size: 11px; }
.chat-preview { font-size: 12px; color: #94a3b8; }

/* Admin Dashboard Styles */
.admin-dashboard-container { padding: 16px; display: flex; flex-direction: column; gap: 16px; max-width: 900px; margin: 0 auto; }
.admin-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #1e293b; padding-bottom: 12px; }
.admin-title { font-size: 18px; font-weight: 800; color: #f8fafc; }
.admin-badge-live { background: rgba(34, 197, 94, 0.2); color: #4ade80; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; border: 1px solid #22c55e; }

.admin-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.admin-tab { background: #1e293b; color: #94a3b8; border: 1px solid #334155; padding: 8px 14px; border-radius: 10px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.admin-tab.active { background: #2563eb; color: #fff; border-color: #3b82f6; }

.admin-tab-pane { display: none; }
.admin-tab-pane.active { display: block; }

.admin-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.admin-stat-card { background: #131722; border-radius: 14px; padding: 16px; border: 1px solid #232a3b; display: flex; flex-direction: column; gap: 6px; }
.admin-stat-label { font-size: 12px; color: #94a3b8; }
.admin-stat-value { font-size: 24px; font-weight: 900; color: #38bdf8; }
.admin-stat-hint { font-size: 10px; color: #64748b; }

.admin-card { background: #131722; border-radius: 16px; padding: 20px; border: 1px solid #232a3b; }
.admin-card-title { font-size: 15px; font-weight: 700; color: #f8fafc; margin-bottom: 12px; }
.admin-tip { font-size: 12px; color: #94a3b8; line-height: 1.5; margin-bottom: 16px; background: rgba(59, 130, 246, 0.1); padding: 10px 14px; border-radius: 10px; border-left: 3px solid #3b82f6; }

.device-status-badge { display: inline-flex; align-items: center; gap: 6px; background: #0f172a; padding: 8px 14px; border-radius: 10px; border: 1px solid #334155; font-size: 12px; color: #4ade80; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px #22c55e; }

.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.admin-form-group { display: flex; flex-direction: column; gap: 6px; }
.admin-form-group label { font-size: 12px; color: #cbd5e1; font-weight: 600; }
.admin-form-group .input { height: 40px; border-radius: 10px; background: #1e293b; border: 1px solid #334155; color: #fff; padding: 0 12px; font-size: 13px; }

.admin-checkbox-group { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; font-size: 13px; color: #f1f5f9; }
.admin-action-row { display: flex; gap: 12px; margin-top: 16px; }

.admin-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12px; }
.admin-table th { text-align: left; padding: 10px; color: #94a3b8; border-bottom: 1px solid #334155; }
.admin-table td { padding: 12px 10px; border-bottom: 1px solid #1e293b; color: #f1f5f9; }
.status-badge { padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.badge-green { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.badge-yellow { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.admin-empty { text-align: center; color: #64748b; padding: 24px; font-size: 13px; }

/* Support Chat Page Styles */
.support-page-container { display: flex; flex-direction: column; height: calc(100vh - 60px); background: #0f172a; }
.support-header { background: #1e293b; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #334155; }
.support-header-left { display: flex; align-items: center; gap: 10px; }
.support-back-btn { background: none; border: none; color: #38bdf8; font-size: 18px; cursor: pointer; padding: 4px 8px; }
.support-avatar-circle { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #059669, #10b981); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.support-name { font-size: 14px; font-weight: 700; color: #f8fafc; }
.support-status { font-size: 11px; color: #4ade80; }

.support-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.support-msg { display: flex; flex-direction: column; max-width: 85%; }
.support-msg.other { align-self: flex-start; }
.support-msg.mine { align-self: flex-end; align-items: flex-end; }
.support-bubble { padding: 12px 16px; border-radius: 14px; font-size: 13px; line-height: 1.6; }
.support-msg.other .support-bubble { background: #1e293b; color: #f8fafc; border: 1px solid #334155; border-bottom-left-radius: 2px; }
.support-msg.mine .support-bubble { background: #2563eb; color: #fff; border-bottom-right-radius: 2px; }
.support-time { font-size: 10px; color: #64748b; margin-top: 4px; padding: 0 4px; }

.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-chip { background: #1e293b; border: 1px solid #3b82f6; color: #38bdf8; padding: 8px 12px; border-radius: 18px; font-size: 12px; cursor: pointer; transition: transform 0.15s, background 0.15s; }
.quick-chip:hover { background: rgba(59, 130, 246, 0.2); transform: scale(1.02); }

.support-footer { display: flex; gap: 8px; padding: 12px; background: #0f172a; border-top: 1px solid #1e293b; }
.support-footer input { flex: 1; height: 42px; border-radius: 20px; background: #1e293b; border: 1px solid #334155; color: #fff; padding: 0 16px; font-size: 13px; }
.support-footer input:focus { outline: none; border-color: #3b82f6; }

/* Rules Page Styles (Matches Screenshot) */
.rules-page-container { display: flex; flex-direction: column; height: 100vh; background: #11141d; color: #cbd5e1; position: relative; overflow: hidden; }
.rules-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: #181d28; border-bottom: 1px solid #232a3b; }
.rules-back-btn { background: none; border: none; color: #f1f5f9; font-size: 14px; cursor: pointer; font-weight: 600; }
.rules-header-title { font-size: 16px; font-weight: 800; color: #ffffff; }
.rules-header-more { color: #94a3b8; font-size: 18px; cursor: pointer; }

.rules-content-body { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 22px; line-height: 1.6; }
.rules-section h3 { font-size: 15px; font-weight: 700; color: #f8fafc; margin-bottom: 8px; border-left: 3px solid #3b82f6; padding-left: 8px; }
.rules-section p { font-size: 13px; color: #94a3b8; margin-bottom: 6px; line-height: 1.6; }

.rules-list { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.rules-list li b { color: #f1f5f9; font-size: 14px; display: block; margin-bottom: 4px; }
.rules-sub { font-size: 12px; color: #94a3b8; margin: 4px 0 0 10px; }

.rules-example-box { background: #1a2234; border: 1px solid #2e3a52; border-radius: 10px; padding: 12px 14px; font-size: 13px; color: #38bdf8; margin: 8px 0; }
.rules-hand-list { list-style: none; padding-left: 0; display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.rules-hand-list li { background: #1a2234; border: 1px solid #232d42; border-radius: 8px; padding: 8px 12px; font-size: 13px; color: #f1f5f9; }
.rules-hand-list li b { color: #fbbf24; }
.rules-hint { font-size: 11px; color: #64748b; margin-top: 4px; }

.rules-reward-box { background: #1a2234; border: 1px solid #2e3a52; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.reward-row { display: flex; justify-content: space-between; font-size: 12px; color: #f1f5f9; }
.reward-row strong { color: #fbbf24; font-weight: 700; }

.rules-bullet-list { padding-left: 18px; font-size: 12px; color: #94a3b8; line-height: 1.8; }

.rules-bottom-bar { position: absolute; bottom: 0; left: 0; right: 0; padding: 14px 20px; background: rgba(17, 20, 29, 0.95); backdrop-filter: blur(8px); border-top: 1px solid #232a3b; }
.rules-enter-btn { width: 100%; height: 46px; border-radius: 24px; font-size: 15px; font-weight: 700; background: #2563eb; }

/* Gold Phase Banners (开始下注 / 停止下注) */
.gold-phase-banner-wrap { display: flex; justify-content: center; margin: 10px 0; }
.gold-phase-banner {
  background: linear-gradient(135deg, #78350f 0%, #b45309 50%, #d97706 100%);
  border: 2px solid #f59e0b; border-radius: 14px; padding: 10px 24px; text-align: center;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4); display: flex; flex-direction: column; align-items: center;
}
.gold-phase-banner.stop {
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 50%, #b91c1c 100%);
  border-color: #ef4444; box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}
.gold-icon { font-size: 26px; }
.gold-banner-title { font-size: 16px; font-weight: 900; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.6); letter-spacing: 1px; }
.gold-sub { font-size: 9px; color: #fde047; font-weight: 700; letter-spacing: 0.5px; }

/* 3D Dice Roll Animation Box */
.dealer-dice-card-wrap { display: flex; justify-content: center; margin: 8px 0; }
.dice-animation-box {
  background: #1e293b; border: 1px solid #334155; border-radius: 14px; padding: 12px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.dice-3d-row { display: flex; gap: 10px; }
.dice-cube {
  background: #f8fafc; color: #0f172a; font-size: 16px; font-weight: 800; padding: 6px 12px;
  border-radius: 10px; box-shadow: 0 4px 0 #cbd5e1; border: 1px solid #e2e8f0;
  animation: diceRollAnim 0.6s ease-out;
}
@keyframes diceRollAnim {
  0% { transform: rotate(0deg) scale(0.6); }
  50% { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(1); }
}
.dice-info-box { text-align: center; }
.dice-title { font-size: 12px; font-weight: 700; color: #fbbf24; }
.dice-detail { font-size: 11px; color: #94a3b8; }
.dice-result { font-size: 13px; font-weight: 700; color: #38bdf8; margin-top: 2px; }

/* Stop Bet Summary Card */
.stop-bet-summary-card { display: flex; justify-content: center; margin: 8px 0; }
.summary-box {
  background: #1a2234; border: 1px solid #2e3a52; border-radius: 12px; padding: 14px 16px;
  width: 90%; max-width: 360px; font-size: 12px; line-height: 1.6; color: #cbd5e1;
}
.summary-line { margin-bottom: 2px; }
.summary-line b { color: #f8fafc; }
.summary-divider { height: 1px; background: #2e3a52; margin: 8px 0; }
.agent-line { font-size: 11px; margin-bottom: 3px; }
.agent-role { color: #38bdf8; font-weight: 600; }
.agent-name { color: #94a3b8; }

/* Tip Card Box (打赏客服小妹) */
.tip-msg-wrap { align-self: flex-start; }
.tip-card-box {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  border-radius: 14px; padding: 12px 16px; color: #fff; border: 1px solid #fbbf24;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3); min-width: 180px;
}
.tip-header { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.tip-amount { font-size: 20px; font-weight: 900; color: #fef08a; margin: 4px 0; }
.tip-footer { font-size: 10px; color: rgba(255,255,255,0.8); }

.cs-avatar { width: 34px; height: 34px; border-radius: 50%; background: #b45309; display: flex; align-items: center; justify-content: center; font-size: 18px; border: 1px solid #fbbf24; }

/* Action Drawer Overlay */
.action-drawer-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; top: 0; background: rgba(0,0,0,0.6);
  display: none; align-items: flex-end; z-index: 99;
}
.action-drawer-overlay.show { display: flex; }
.action-drawer-content {
  background: #1e293b; width: 100%; border-top-left-radius: 20px; border-top-right-radius: 20px;
  padding: 16px 20px 24px; border-top: 1px solid #334155; animation: slideUpDrawer 0.2s ease-out;
}
@keyframes slideUpDrawer { from { transform: translateY(100%); } to { transform: translateY(0); } }
.drawer-header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; color: #f1f5f9; margin-bottom: 16px; }
.drawer-close { background: none; border: none; color: #94a3b8; font-size: 16px; cursor: pointer; }
.drawer-items { display: flex; gap: 24px; }
.drawer-item { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.drawer-icon { width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 28px; border: 1px solid #334155; }
.drawer-icon.packet { background: linear-gradient(135deg, #b91c1c, #ef4444); border-color: #f87171; }
.drawer-icon.tip { background: linear-gradient(135deg, #b45309, #f59e0b); border-color: #fbbf24; }
.drawer-label { font-size: 12px; color: #cbd5e1; font-weight: 600; }

/* Rewards Page Styles (Matches Screenshot 5) */
.rewards-page-container { display: flex; flex-direction: column; min-height: 100vh; background: #11141d; color: #cbd5e1; }
.rewards-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: #181d28; border-bottom: 1px solid #232a3b; }
.rewards-back-btn { background: none; border: none; color: #f1f5f9; font-size: 14px; cursor: pointer; font-weight: 600; }
.rewards-header-title { font-size: 16px; font-weight: 800; color: #ffffff; }
.rewards-header-more { color: #94a3b8; font-size: 18px; cursor: pointer; }

.rewards-nav-tabs { display: flex; background: #181d28; border-bottom: 1px solid #232a3b; }
.rewards-tab { flex: 1; padding: 12px 0; background: none; border: none; font-size: 14px; font-weight: 600; color: #94a3b8; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; }
.rewards-tab.active { color: #f59e0b; border-bottom-color: #f59e0b; }

.rewards-tab-body { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-bottom: 60px; }
.rewards-card { background: #181d28; border: 1px solid #232a3b; border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }

.milestone-title { font-size: 14px; font-weight: 700; color: #f1f5f9; margin-bottom: 6px; }
.milestone-title b { color: #38bdf8; font-size: 16px; }

.timeline-box { display: flex; flex-direction: column; gap: 12px; position: relative; padding-left: 10px; margin: 6px 0; }
.timeline-box::before { content: ''; position: absolute; left: 16px; top: 10px; bottom: 10px; width: 2px; background: #334155; }
.timeline-row { display: flex; align-items: center; justify-content: space-between; position: relative; padding-left: 20px; }
.timeline-dot { width: 14px; height: 14px; border-radius: 50%; background: #1e293b; border: 2px solid #64748b; position: absolute; left: 0; z-index: 2; }
.timeline-dot.reached { background: #38bdf8; border-color: #0284c7; box-shadow: 0 0 8px #38bdf8; }
.timeline-dot.current { border-color: #38bdf8; background: #0f172a; }
.timeline-label { font-size: 13px; color: #cbd5e1; }
.timeline-label b { color: #f8fafc; }
.timeline-reward { font-size: 14px; font-weight: 800; color: #38bdf8; }
.timeline-hint { font-size: 11px; color: #94a3b8; line-height: 1.5; margin-top: 4px; }

.special-card { background: #181d28; border: 1px solid #283144; }
.special-header { display: flex; justify-content: space-between; align-items: center; }
.special-name { font-size: 14px; font-weight: 700; color: #f1f5f9; }
.special-amount { font-size: 16px; font-weight: 900; color: #f59e0b; }
.special-badges { display: flex; gap: 6px; margin: 4px 0; }
.badge-chip { background: #232d42; border: 1px solid #334155; border-radius: 6px; padding: 3px 8px; font-size: 11px; color: #94a3b8; font-weight: 600; }
.badge-chip.collected { background: rgba(56,189,248,.15); border-color: #38bdf8; color: #38bdf8; }
.special-desc { font-size: 11px; color: #94a3b8; line-height: 1.4; }
.special-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.remaining-tag { font-size: 11px; color: #64748b; }

.monster-card { background: linear-gradient(135deg, #181d28 0%, #201a2e 100%); border-color: #a855f7; }
.monster-header { display: flex; justify-content: space-between; align-items: center; }
.monster-tag { font-size: 11px; font-weight: 700; color: #d8b4fe; }
.monster-amount { font-size: 20px; font-weight: 900; color: #fbbf24; }
.monster-title { font-size: 15px; font-weight: 800; color: #fff; margin-top: 4px; }
.monster-desc { font-size: 11px; color: #cbd5e1; }
.monster-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.section-sub-title { font-size: 14px; font-weight: 700; color: #fbbf24; margin-bottom: 6px; }
.king-list { display: flex; flex-direction: column; gap: 10px; }
.king-item { display: flex; justify-content: space-between; align-items: center; background: #1f2738; padding: 10px 12px; border-radius: 10px; border: 1px solid #2a3449; }
.king-sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.king-reward { color: #f59e0b; font-size: 14px; }

.weekly-rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-row { display: flex; justify-content: space-between; align-items: center; background: #1f2738; padding: 8px 12px; border-radius: 8px; font-size: 13px; color: #cbd5e1; }
.rank-row strong { color: #f59e0b; }
.rank-row.gold { border-left: 3px solid #fbbf24; }
.rank-row.silver { border-left: 3px solid #cbd5e1; }
.rank-row.bronze { border-left: 3px solid #b45309; }

/* Generic page/tabs/list — used by leaderboard.js, and reusable by other list pages */
.page { padding: 16px; }
.page-title { font-size: 18px; font-weight: 600; text-align: center; margin-bottom: 16px; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; }
.tabs .tab { flex: 1; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text-dim); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tabs .tab.active { background: var(--blue-deep); color: #fff; }
.lb-threshold { font-size: 11px; color: var(--text-dim); text-align: center; margin-bottom: 10px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.list-item.top3 { border-color: var(--gold); }
.list-item.me { border-color: var(--blue); }
.list-item.hidden-entry { opacity: 0.7; }
.list-item .medal { font-size: 18px; width: 24px; text-align: center; }
.list-item .rank { font-size: 13px; color: var(--text-dim); width: 24px; text-align: center; font-weight: 700; }
.list-item .avatar { width: 36px; height: 36px; border-radius: 50%; margin: 0; font-size: 14px; }
.list-item .avatar-fallback.hidden-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 16px; }
.list-item-body { flex: 1; min-width: 0; }
.list-item .name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .score { font-size: 14px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.empty, .error { text-align: center; padding: 40px; color: var(--text-dim); font-size: 13px; }
.error { color: var(--red); }






