:root {
  --bg: #f3f7ff;
  --panel: #ffffff;
  --panel2: #eef4ff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d6e0f5;
  --primary: #1d7ef7;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
}
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Noto Sans", sans-serif;
  background: radial-gradient(1200px 600px at 10% -20%, #dbeafe 0%, var(--bg) 55%);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 16px; }
.auth-wrap { min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 16px; }
.card {
  width: 100%;
  background: linear-gradient(180deg, var(--panel) 0%, #f7faff 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(29, 78, 216, 0.08);
  padding: 16px;
}
.card.auth { max-width: 450px; }
h1, h2, h3 { margin: 0 0 12px; }
p { margin: 6px 0; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 860px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--muted); }
input, select {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px;
}
textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px;
  resize: vertical;
  min-height: 110px;
}
button {
  border: 0;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  touch-action: manipulation;
}
button, a, input, select, textarea {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
button.ghost { background: #eef4ff; color: var(--text); border: 1px solid var(--line); }
button.warn { background: var(--warn); color: #111; }
button.bad { background: var(--bad); color: #fff; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
}
.topbar .container { display: flex; justify-content: space-between; align-items: center; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav button { background: #eef4ff; color: var(--text); }
.nav button.active { background: var(--primary); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
@media (max-width: 980px) { .stats { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
}
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 20px; margin-top: 6px; font-weight: 700; }
#tab-bridge .stats {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
#tab-bridge .stat {
  min-width: 150px;
  border-radius: 10px;
  padding: 8px 10px;
}
#tab-bridge .stat .k {
  font-size: 11px;
  white-space: nowrap;
}
#tab-bridge .stat .v {
  font-size: 16px;
  margin-top: 2px;
  line-height: 1.15;
}
.section { margin-top: 14px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th { color: var(--muted); background: #f3f7ff; }
.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  font-size: 12px;
}
.tag.ok { color: #a7f3d0; border-color: #0e7a46; background: rgba(34,197,94,.15);}
.tag.off { color: #fecaca; border-color: #7f1d1d; background: rgba(239,68,68,.15);}
.muted { color: var(--muted); }
.toast {
  position: fixed; right: 14px; bottom: 14px; min-width: 260px;
  background: #ffffff; border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  color: var(--text); border-radius: 10px; padding: 10px; z-index: 1000;
}
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: none; align-items: center; justify-content: center; z-index: 2200;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.modal-mask.show { display: flex; pointer-events: auto; }
.modal {
  max-width: 520px;
  width: 100%;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.modal-mobile {
  border-radius: 18px;
  border: 1px solid #e6e8ee;
}
.modal-grip {
  width: 46px;
  height: 5px;
  border-radius: 999px;
  background: #d6dce8;
  margin: 2px auto 12px auto;
}
.modal-mobile .row.section {
  justify-content: flex-end;
}
@media (max-width: 560px) {
  .modal-mask {
    align-items: flex-end;
    padding: 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, .45);
  }
  .modal {
    max-height: calc(100dvh - 12px - env(safe-area-inset-bottom));
  }
  .modal-mobile {
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    max-width: 430px;
    padding: 14px 14px 16px 14px;
    animation: modalUp .18s ease-out;
  }
  .modal-mobile .grid2 {
    grid-template-columns: 1fr;
  }
  .modal-mobile .row.section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}
@keyframes modalUp {
  from { transform: translateY(14px); opacity: .7; }
  to { transform: translateY(0); opacity: 1; }
}
.notif-badge {
  background: var(--bad); color: #fff; border-radius: 999px; font-size: 12px; padding: 2px 8px;
}

/* coffer-like mobile ui */
.mobile-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f3f3f3;
  border-left: 1px solid #e8e8e8;
  border-right: 1px solid #e8e8e8;
}
.mobile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px 6px 12px;
  background: #fff;
  border-bottom: 1px solid #ececec;
}
.coffer-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #ececec;
  padding: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,.04);
}
.coffer-points {
  margin-top: 6px;
  font-size: 38px;
  font-weight: 800;
  color: #202020;
}
.mini-id { font-size: 12px; color: #9b9b9b; margin-top: 4px; }
.coffer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.coffer-action-btn {
  background: #f8f0db;
  color: #3c3c3c;
  border: 1px solid #f0d89a;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.icon-dot {
  color: #347eff;
  font-size: 10px;
}
.invite-chest {
  margin-top: 12px;
  border: 1px solid #e9c96a;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffaf0 0%, #fff 100%);
  padding: 10px 12px;
}
.progress-line {
  margin-top: 8px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #f3e7c7;
  overflow: hidden;
}
.progress-line span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ffae00 0%, #f18800 100%);
}
.reward-btn {
  width: 100%;
  margin-top: 12px;
  border-radius: 11px;
  background: linear-gradient(180deg, #ff9d00 0%, #f07b00 100%);
  color: #fff;
  border: 0;
  font-weight: 800;
}
.coffer-news, .coffer-mini {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 14px;
  padding: 12px;
}
.coffer-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  z-index: 100;
}
.coffer-bottom-inner {
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-top: 1px solid #ececec;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 8px 8px 10px 8px;
  gap: 6px;
}
.coffer-tab {
  background: transparent;
  color: #7f7f7f;
  border: 0;
  font-size: 12px;
  padding: 6px 4px;
}
.coffer-tab.active {
  color: #e08b00;
  font-weight: 700;
}
.coffer-add {
  margin-top: -30px;
  width: 62px;
  height: 62px;
  border-radius: 999px;
  justify-self: center;
  background: radial-gradient(circle at 35% 30%, #ffe6b6 0%, #ffd27d 45%, #f6b640 100%);
  border: 4px solid #fff5dd;
  box-shadow: 0 10px 20px rgba(0,0,0,.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* refined mobile coffer pages */
.mobile-content {
  padding: 10px 10px 92px 10px;
}
.avatar-mini {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7b500;
  color: #1c3d9b;
  border: 2px solid #1c3d9b;
}
.card.soft {
  background: #fff;
  border: 1px solid #e9e9e9;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
}
.greet { font-size: 36px; font-weight: 700; color: #222; }
.wave { font-size: 30px; margin-top: 6px; margin-bottom: 10px; }
.big-points {
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 52px;
  font-weight: 800;
  color: #1b2f4f;
  line-height: 1;
}
.quick-two {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.quick-btn {
  border-radius: 16px;
  border: 1px solid #ebdfbf;
  background: #f6efdf;
  color: #222;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 10px;
}
.quick-ic {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2f6dea;
  color: #fff;
  font-size: 14px;
}
.invite-box {
  margin-top: 14px;
  border: 2px solid #f0a01d;
  border-radius: 18px;
  padding: 12px;
  background: #fff;
}
.invite-arrow {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f6e6be;
  color: #d68000;
}
.reward-btn {
  margin-top: 14px;
  border-radius: 14px;
  font-size: 25px;
  padding: 14px;
}
.hosting-btn {
  width: 100%;
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid #99bcff;
  background: linear-gradient(180deg, #4f8fff 0%, #2f6dea 100%);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  padding: 13px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 16px rgba(47, 109, 234, 0.24);
}
.hosting-ic {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.35);
  font-size: 13px;
  line-height: 1;
}
.coffer-bottom-inner {
  border-top: 1px solid #ececec;
  background: #f4f4f4;
}
.coffer-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1.25;
  color: #8b8f98;
  gap: 4px;
}
.coffer-tab .tab-ic {
  font-size: 20px;
  line-height: 1;
}
.coffer-tab > span:last-child {
  margin-top: 2px;
}
.coffer-tab.active {
  color: #ff8d00;
}
.coffer-add {
  width: 60px;
  height: 60px;
  margin-top: -28px;
  border: 5px solid #fff2df;
  background: radial-gradient(circle at 35% 30%, #ffe6b6 0%, #ffd27d 45%, #f6b640 100%);
}
.coffer-add-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #1c3d9b;
  color: #ffd464;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}
.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mini-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px;
}
.mini-stat {
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}
.mini-stat .v {
  color: #165dff;
  font-size: 34px;
  font-weight: 800;
}
.level-box {
  border: 1px solid #d8e4ff;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.level-box.level-a { background: #eef5ff; }
.level-box.level-b { background: #fff; border-color: #e7e7e7; }
.level-rate {
  font-size: 32px;
  font-weight: 800;
  color: #165dff;
}
.list-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
}
.list-line.danger { color: #ef4444; }
.withdraw-profile-view {
  display: grid;
  gap: 8px;
}
.withdraw-profile-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #e9edf6;
  background: #f8fbff;
  border-radius: 10px;
  padding: 10px;
}
.withdraw-history-list {
  display: grid;
  gap: 8px;
}
.history-head {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}
.history-head h2 {
  margin: 0;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  color: #1f2f4a;
}
.history-back, .history-filter {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #dce3f5;
  background: #f5f8ff;
  color: #304869;
  padding: 0;
  font-size: 18px;
}
.history-body {
  min-height: 420px;
}
.history-empty {
  text-align: center;
  padding: 40px 10px 24px 10px;
}
.history-empty-icon {
  width: 84px;
  height: 84px;
  border-radius: 999px;
  margin: 0 auto 14px auto;
  background: #f0f3fa;
  color: #90a0bc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
}
.history-no-more {
  text-align: center;
  color: #8f9bb2;
  margin-top: 24px;
  font-size: 18px;
}
.withdraw-item {
  border: 1px solid #e7eaf3;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}
.withdraw-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.withdraw-status {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}
.withdraw-status.wait {
  color: #92400e;
  background: #fff7e6;
  border: 1px solid #f5d9a8;
}
.withdraw-status.ok {
  color: #166534;
  background: #ecfdf3;
  border: 1px solid #8fe1b5;
}
.withdraw-status.bad {
  color: #b91c1c;
  background: #fff1f2;
  border: 1px solid #f7b4bb;
}
.center-reward { border: 1px solid #f2d187; }
.reward-icon {
  width: 54px; height: 54px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #5a8cff 0%, #9d4edd 100%);
  color: #fff; font-size: 24px;
}
.benefit-card {
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
  border: 1px solid #e5e8ef;
  background: #fff;
}
.benefit-card.blue { border-color: #d7e4ff; }
.benefit-card.purple { border-color: #eadcf8; }
.benefit-card.green { border-color: #d5f0dc; }
.center-note {
  margin-top: 10px;
  border: 1px solid #a6c5ff;
  background: #eef5ff;
  color: #265ec7;
  border-radius: 12px;
  padding: 10px;
}
.center-empty {
  text-align: center;
  padding: 24px;
}
.bound-card-list {
  display: grid;
  gap: 10px;
}
.bound-card {
  padding: 12px;
}
.bound-card.bound-offline {
  border: 1px solid #ffb3b3;
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.12);
  background: linear-gradient(180deg, #fff7f7 0%, #ffffff 100%);
}
.bound-card.bound-normal {
  border: 1px solid #d9e7ff;
}
.bound-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.bound-phone {
  font-size: 16px;
  font-weight: 700;
  color: #1f3558;
  word-break: break-all;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}
.status-normal {
  color: #0f6f3c;
  border: 1px solid #8ad9af;
  background: #ecfff4;
}
.status-normal .status-dot {
  background: #16a34a;
}
.status-offline {
  color: #b91c1c;
  border: 1px solid #ffb3b3;
  background: #fff0f0;
}
.status-offline .status-dot {
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
  animation: offlinePulse 1.4s infinite;
}
@keyframes offlinePulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.48); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.bound-mid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.bound-mid > div {
  background: #f7faff;
  border: 1px solid #e5eefc;
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
}
.bound-bottom {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}
.bound-action {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.bound-action .warn {
  white-space: nowrap;
}
.bound-action .bad {
  white-space: nowrap;
}
@media (max-width: 560px) {
  .bound-bottom {
    grid-template-columns: 1fr;
  }
  .bound-action {
    justify-content: stretch;
  }
  .bound-action button {
    width: 100%;
  }
}
.phone-prefix-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wa-add-grid {
  grid-template-columns: 0.95fr 1.45fr;
  gap: 10px;
}
.wa-country-field select {
  max-width: 180px;
}
.register-phone-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.52fr);
  gap: 10px;
  align-items: end;
}
.register-country-field select {
  width: 100%;
  max-width: 170px;
}
.register-phone-field {
  min-width: 0;
}
.register-phone-inline {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.phone-prefix {
  min-width: 58px;
  text-align: center;
  font-weight: 700;
  color: #2d4f86;
  background: #eef4ff;
  border: 1px solid #d9e6ff;
  border-radius: 10px;
  padding: 10px 8px;
}
.phone-prefix-wrap input {
  flex: 1;
}
@media (max-width: 560px) {
  .wa-add-grid {
    grid-template-columns: 0.88fr 1.12fr;
  }
  .register-phone-grid {
    grid-template-columns: minmax(0, 0.84fr) minmax(0, 1.16fr);
  }
  .register-country-field select {
    max-width: 100%;
  }
  .wa-country-field select {
    max-width: 100%;
  }
  /* iOS: prevent auto-zoom on focus by using >=16px controls */
  .modal-mobile input,
  .modal-mobile select,
  .modal-mobile textarea {
    font-size: 16px;
    min-height: 46px;
    padding: 11px 12px;
    border-radius: 12px;
  }
  .modal-mobile label {
    font-size: 15px;
    margin-bottom: 8px;
  }
  .modal-mobile h3 {
    font-size: 34px;
    margin-bottom: 10px;
  }
  .modal-mobile .muted {
    font-size: 16px;
    line-height: 1.45;
  }
  .phone-prefix {
    min-width: 68px;
    font-size: 16px;
    padding: 11px 10px;
  }
  #wa-country,
  #wa-method,
  #wa-phone {
    font-size: 16px;
  }
}
.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 10px auto;
  border-radius: 999px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.tag-btn {
  background: #ff7f00;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
}
.coffer-add.active {
  box-shadow: 0 12px 22px rgba(255,150,0,.35);
}
.news-content-input {
  min-height: 120px;
}
.news-click-item {
  cursor: pointer;
}
.news-click-item:hover {
  opacity: 0.92;
}
.news-home-list {
  display: grid;
  gap: 8px;
}
.news-home-item {
  border: 1px solid #e8edf8;
  background: #f9fbff;
  border-radius: 12px;
  padding: 10px 12px;
  transition: all .15s ease;
}
.news-home-item:hover {
  border-color: #cfdcff;
  background: #f3f7ff;
  transform: translateY(-1px);
}
.news-home-title {
  color: #2b4773;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
  word-break: break-word;
}
.news-home-time {
  margin-top: 4px;
  color: #8a97ad;
  font-size: 13px;
}
.news-detail-modal {
  max-height: 82vh;
  overflow-y: auto;
}
.news-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.news-detail-head h3 {
  margin: 0;
}
.news-detail-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex: 0 0 auto;
}
