*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #07c160; --primary-dark: #06ad56; --primary-light: #e8f8ee;
  --bg: #f5f7fa; --card-bg: #fff;
  --text: #1a1a2e; --text-secondary: #6b7280; --text-light: #9ca3af;
  --border: #e5e7eb; --shadow: 0 1px 3px rgba(0,0,0,.08);
  --radius: 10px; --radius-lg: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }

/* ====== Topbar ====== */
#topbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; justify-content: space-between; }
.topbar-logo { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: var(--primary); }
.topbar-logo svg { width: 24px; height: 24px; }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a { text-decoration: none; color: var(--text-secondary); font-size: 14px; padding: 8px 14px; border-radius: 6px; transition: .15s; }
.topbar-nav a:hover, .topbar-nav a.active { background: var(--primary-light); color: var(--primary); }

/* ====== Main ====== */
main { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* ====== Stats ====== */
.stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; }
.stat-value { font-size: 15px; color: var(--text-secondary); }
.stat-num { font-size: 26px; font-weight: 700; color: var(--text); }

/* ====== Section ====== */
.section { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.section-header { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.section-header h2 { font-size: 16px; font-weight: 600; }
.section-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.hint { font-size: 12px; color: var(--text-light); font-weight: 400; }

/* ====== Buttons ====== */
.btn { display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; padding: 7px 16px; transition: .15s; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn { background: var(--primary); color: #fff; }
.btn:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
select { border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px; outline: none; background: #fff; color: var(--text); cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Android Emoji', sans-serif; }

/* ====== Number Grid ====== */
.number-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 12px; padding: 16px 20px; }
.number-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; transition: .15s; }
.number-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(7,193,96,.12); }
.number-card.active { border-color: var(--primary); background: var(--primary-light); }
.number-card .country { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.number-card .phone { font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.number-card .price { font-size: 12px; color: var(--primary); margin-top: 6px; font-weight: 500; }
.number-card .card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.number-card .card-bottom .status-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.number-card .buy-btn { font-size: 12px; padding: 3px 14px; border-radius: 12px; border: none; background: var(--primary); color: #fff; cursor: pointer; font-weight: 500; transition: .15s; }
.number-card .buy-btn:hover { background: var(--primary-dark); }
.number-card .status-badge.available { background: #dcfce7; color: #166534; }
.number-card .status-badge.busy { background: #fef3c7; color: #92400e; }

/* ====== SMS List ====== */
.sms-list { padding: 16px 20px; min-height: 120px; }
.sms-empty { text-align: center; padding: 40px 0; color: var(--text-light); font-size: 14px; }
.sms-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f3f4f6; }
.sms-item:last-child { border-bottom: none; }
.sms-item .sms-sender { width: 36px; height: 36px; background: var(--primary-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.sms-item .sms-body { flex: 1; min-width: 0; }
.sms-item .sms-body .sms-from { font-size: 13px; font-weight: 500; }
.sms-item .sms-body .sms-from small { font-weight: 400; color: var(--text-light); margin-left: 8px; }
.sms-item .sms-body .sms-text { font-size: 14px; margin-top: 3px; word-break: break-all; }
.sms-item .sms-body .sms-text .code { background: #fef3c7; color: #92400e; padding: 1px 6px; border-radius: 4px; font-weight: 600; font-size: 15px; }

/* ====== Footer ====== */
.footer { text-align: center; padding: 30px 20px; color: var(--text-light); font-size: 13px; }

/* ====== Logo Section（支持验证） ====== */
.logo-section { margin-bottom: 20px; }
.logo-grid { display: flex; gap: 20px; padding: 24px 20px; justify-content: center; flex-wrap: wrap; }
.logo-item img { height: auto; border-radius: 8px; transition: transform .2s, box-shadow .2s; object-fit: contain; }
.logo-item:hover img { transform: scale(1.08); box-shadow: 0 4px 16px rgba(0,0,0,.1); }

/* ====== Country ====== */
.country { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', 'Android Emoji', EmojiSymbols, sans-serif; }
.country .flag-icon { width: 20px; height: 14px; vertical-align: middle; border-radius: 2px; object-fit: cover; }

/* ====== Notice ====== */
.notice-card { background: #fef3c7; border: 1px solid #fde68a; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; font-size: 16px; font-weight: 600; color: #92400e; line-height: 1.6; display: flex; align-items: flex-start; gap: 10px; }
.notice-card::before { content: '💡'; flex-shrink: 0; font-size: 20px; }

/* ====== Chat FAB ====== */
.chat-fab { position: fixed; bottom: 24px; right: 24px; width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer; box-shadow: 0 4px 16px rgba(7,193,96,.35); display: flex; align-items: center; justify-content: center; z-index: 200; transition: .2s; }
.chat-fab svg { pointer-events: none; }
.chat-fab:hover { transform: scale(1.08); background: var(--primary-dark); }
.chat-fab-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 10px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* ====== Chat Drawer ====== */
.chat-drawer { position: fixed; bottom: 88px; right: 24px; width: 360px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 120px); background: #fff; border-radius: var(--radius-lg); box-shadow: 0 8px 32px rgba(0,0,0,.15); display: none; flex-direction: column; z-index: 201; overflow: hidden; }
.chat-drawer.open { display: flex; }
.chat-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--primary); color: #fff; font-weight: 600; font-size: 15px; flex-shrink: 0; }
.chat-close-btn { background: none; border: none; color: #fff; font-size: 16px; cursor: pointer; opacity: .7; padding: 4px; }
.chat-close-btn:hover { opacity: 1; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; background: #f0f4f8; }
.chat-placeholder { text-align: center; color: var(--text-light); font-size: 13px; padding: 40px 0; }
.chat-msg { margin-bottom: 12px; display: flex; }
.chat-msg.chat-msg-me { justify-content: flex-end; }
.chat-msg.chat-msg-other { justify-content: flex-start; }
.chat-msg .bubble { max-width: 80%; padding: 9px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; word-break: break-word; }
.chat-msg-me .bubble { background: #95ec69; border-bottom-right-radius: 4px; }
.chat-msg-other .bubble { background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.chat-msg .time { font-size: 10px; color: var(--text-light); margin-top: 3px; text-align: right; }
.chat-input-row { display: flex; align-items: flex-end; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border); background: #fff; flex-shrink: 0; }
.chat-input-row textarea { flex: 1; border: none; resize: none; outline: none; font-size: 14px; font-family: inherit; padding: 8px 0; max-height: 80px; line-height: 1.4; }
.chat-img-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 6px; border-radius: 6px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: .15s; }
.chat-img-btn svg { pointer-events: none; }
.chat-img-btn:hover { background: #f3f4f6; color: var(--text); }
.chat-send-btn { background: var(--primary); color: #fff; border: none; border-radius: 18px; padding: 8px 20px; font-size: 14px; cursor: pointer; flex-shrink: 0; font-weight: 500; }
.chat-send-btn:hover { background: var(--primary-dark); }
.chat-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 199; display: none; }

/* SMS notification bubbles - all visible, scroll down loop */
.sms-bubbles {
  position: fixed;
  right: 10px;
  top: 80px;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
  height: 158px;
}
.sms-track {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  animation: scrollDown 4s linear infinite;
}
.sms-bubble {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
  font-size: 15px;
  color: #333;
  line-height: 1.5;
  white-space: nowrap;
  width: fit-content;
}
@keyframes scrollDown {
  0% { transform: translateY(-158px); }
  100% { transform: translateY(0); }
}
@media (max-width: 640px) { .sms-bubbles { display: none; } }

/* Visually hidden file input (cross-browser, vs HTML hidden attr which Firefox ignores for click()) */
.file-input-hidden { position: fixed; left: -9999px; top: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Image messages in chat */
.chat-msg .bubble .msg-bubble-image { line-height: 0; }
.chat-msg .bubble .msg-image { max-width: 200px; max-height: 200px; border-radius: 6px; display: block; cursor: zoom-in; }
.chat-msg .bubble .msg-bubble-text { word-break: break-word; }

/* ====== 左侧广告（与聊天窗口同级大小） ====== */
.adblock { position: fixed; left: 20px; top: 0; bottom: 0; margin: auto; width: 320px; height: fit-content; z-index: 50; }
.adblock-inner { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 8px 32px rgba(0,0,0,.12); overflow: hidden; }
.adblock-label { display: block; text-align: center; font-size: 12px; color: var(--text-light); letter-spacing: 2px; padding: 8px 0 4px; }
.adblock-link { display: block; padding: 24px 28px 28px; text-decoration: none; color: var(--text); text-align: center; transition: .1s; }
.adblock-link:hover { background: #fafcff; }
.adblock-ico { color: var(--primary); margin-bottom: 12px; }
.adblock-tit { font-size: 22px; font-weight: 700; line-height: 1.35; margin-bottom: 10px; }
.adblock-tit.en { font-size: 20px; }
.adblock-desc { font-size: 16px; color: var(--text-secondary); line-height: 1.6; }
.adblock-desc.en { font-size: 15px; }
.adblock-btn { display: inline-block; margin-top: 16px; padding: 10px 28px; background: var(--primary); color: #fff; border-radius: 24px; font-size: 15px; font-weight: 500; transition: .15s; }
.adblock-link:hover .adblock-btn { background: var(--primary-dark); }
.adblock-divider { height: 1px; background: var(--border); margin: 0 20px; }

/* ====== Mobile ====== */
@media (max-width: 640px) {
  .topbar-nav { display: none; }
  .topbar-logo { font-size: 17px; }
  main { padding: 14px; }
  .section-header { padding: 14px 16px; }
  .section-header h2 { font-size: 15px; }
  .stats-bar { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 14px; }
  .stat-num { font-size: 22px; }
  .number-grid { grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 16px; }
  .number-card { padding: 12px; }
  .number-card .phone { font-size: 16px; letter-spacing: 0; }
  .number-card .buy-btn { padding: 4px 12px; min-height: 30px; }
  .notice-card { font-size: 14px; padding: 12px 14px; }
  .sms-list { padding: 12px 16px; }
  .logo-grid { padding: 16px; gap: 12px; }
  .logo-item img { width: 100%; max-width: 180px; }
  .chat-drawer { right: 0; bottom: 0; width: 100vw; max-width: 100vw; border-radius: 0; }
  .chat-drawer { height: 50vh; max-height: 50vh; }
  .chat-drawer-header { padding: 10px 18px calc(10px + var(--safe-b)); font-size: 14px; flex-direction: row-reverse; }
  .chat-drawer-header::before { content: ''; width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.4); position: absolute; top: 6px; left: 50%; transform: translateX(-50%); }
  .chat-drawer-header span { flex: 1; text-align: center; }
  .chat-fab { bottom: 16px; right: 16px; width: 48px; height: 48px; }
  .chat-fab-badge { min-width: 18px; height: 18px; font-size: 10px; }
  .chat-msg .bubble { max-width: 88%; font-size: 15px; }
  .chat-msg .bubble .msg-image { max-width: 160px; max-height: 160px; }
  .chat-send-btn { padding: 8px 16px; font-size: 15px; min-height: 38px; }
  .chat-img-btn { padding: 8px; }
  .chat-input-row textarea { font-size: 15px; }
  .chat-close-btn { font-size: 20px; padding: 8px; }
  .footer { font-size: 12px; padding: 24px 16px; }
}

@media (max-width: 480px) {
  .stats-bar { grid-template-columns: 1fr; }
  .number-grid { grid-template-columns: 1fr; }
  .chat-msg .bubble { max-width: 92%; }
}

@media (max-width: 1300px) {
  .adblock { display: none; }
}
