/* ==========================================================================
   接码站设计系统 —— 设计令牌 + 组件样式
   ========================================================================== */
:root {
  --brand: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;
  --brand-soft: #eef4ff;
  --bg: #f4f7fc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5fb;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --line: #e4eaf3;
  --line-strong: #cfd8e8;
  --ok: #16a34a;
  --ok-soft: #e9f9f0;
  --warn: #d97706;
  --warn-soft: #fff6e6;
  --err: #dc2626;
  --err-soft: #fdeced;
  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 6px rgba(15, 23, 42, .04);
  --shadow-2: 0 10px 30px rgba(15, 23, 42, .09), 0 2px 8px rgba(15, 23, 42, .05);
  --shadow-3: 0 24px 60px rgba(15, 23, 42, .18);
  --ring: 0 0 0 3px rgba(37, 99, 235, .18);
}

html[data-theme="dark"] {
  --brand: #5b8cff;
  --brand-600: #4379f5;
  --brand-700: #3567e0;
  --brand-soft: #172440;
  --bg: #080e1a;
  --surface: #101a2c;
  --surface-2: #16223a;
  --surface-3: #1b2942;
  --text: #e9effb;
  --text-2: #c3cfe4;
  --muted: #8b9dbe;
  --line: #23324e;
  --line-strong: #33456a;
  --ok: #34d399;
  --ok-soft: #10281f;
  --warn: #fbbf24;
  --warn-soft: #2b2210;
  --err: #f87171;
  --err-soft: #2c1518;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, .5);
  --shadow-3: 0 24px 70px rgba(0, 0, 0, .62);
  --ring: 0 0 0 3px rgba(91, 140, 255, .25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.2px; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand) 0%, #7c5cff 100%);
  color: #fff; font-size: 17px; box-shadow: var(--shadow-1);
}
.nav { display: flex; gap: 4px; margin-left: 8px; flex-wrap: wrap; }
.nav button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600;
  padding: 7px 13px; border-radius: 999px; cursor: pointer; transition: .16s;
}
.nav button:hover { background: var(--surface-3); color: var(--text); }
.nav button.active { background: var(--brand-soft); color: var(--brand-700); }
html[data-theme="dark"] .nav button.active { color: #bcd0ff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.balance-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: 13.5px;
}
html[data-theme="dark"] .balance-chip { color: #7ff0bb; }

/* ---------------- 通用组件 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 17px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; transition: .16s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-1); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { color: #fff; filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13.5px; }
.btn-block { width: 100%; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 16.5px; font-weight: 700; }
.card-head .sub { color: var(--muted); font-size: 13px; margin-left: auto; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 16px 20px 70px; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font: inherit; outline: none; transition: .16s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--ring); background: var(--surface); }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--muted);
}
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-err { background: var(--err-soft); color: var(--err); }
.tag-brand { background: var(--brand-soft); color: var(--brand-700); }
html[data-theme="dark"] .tag-brand { color: #bcd0ff; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.ok { color: var(--ok); font-weight: 700; }
.err { color: var(--err); font-weight: 700; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------------- 首页 Hero ---------------- */
.hero {
  border-radius: 22px; padding: 30px 30px 26px; margin-bottom: 18px;
  background: linear-gradient(135deg, #101a33 0%, #1e3a8a 55%, #4f46e5 100%);
  color: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow-2);
}
.hero:after {
  content: ""; position: absolute; right: -70px; top: -70px; width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 65%); border-radius: 50%;
}
.hero h1 { margin: 0 0 8px; font-size: 27px; font-weight: 800; letter-spacing: -.4px; }
.hero p { margin: 0 0 20px; color: #cddaff; font-size: 14.5px; max-width: 640px; }
.hero-stats { display: flex; gap: 26px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-stats div { font-size: 13px; color: #b9c9f0; }
.hero-stats b { display: block; font-size: 21px; color: #fff; font-weight: 800; }

.searchbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; position: relative; z-index: 1; }
.searchbar .field { margin: 0; flex: 1 1 180px; }
.searchbar .field > span { color: #c9d6f5; }
.searchbar input, .searchbar select { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .28); color: #fff; }
.searchbar input::placeholder { color: #b9c8ea; }
.searchbar option { color: #0f172a; }

/* ---------------- 服务卡片列表 ---------------- */
.svc-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.svc {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface);
  transition: .16s; cursor: pointer;
}
.svc:hover { border-color: var(--brand); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.svc-icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-700); font-weight: 800; font-size: 15px; flex: none;
}
html[data-theme="dark"] .svc-icon { color: #bcd0ff; }
.svc-body { min-width: 0; flex: 1; }
.svc-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.svc-price { font-weight: 800; color: var(--brand); font-size: 16px; white-space: nowrap; }
.svc-price small { font-weight: 600; font-size: 11.5px; color: var(--muted); display: block; text-align: right; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 18px; }
.chip {
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: .16s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.country-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); max-height: 340px; overflow: auto; }
.country-item {
  padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; transition: .16s; display: flex; align-items: center; gap: 8px;
}
.country-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.country-item.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-700); font-weight: 700; }
html[data-theme="dark"] .country-item.active { color: #bcd0ff; }
.country-item b { font-weight: 700; font-size: 14px; }
.country-item small { color: var(--muted); font-size: 12px; }

/* ---------------- 订单弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 80; background: rgba(8, 14, 26, .55);
  backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 560px; background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-3); border: 1px solid var(--line); overflow: hidden;
  max-height: 92vh; display: flex; flex-direction: column;
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px 22px; overflow: auto; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; background: var(--surface-2); }

.phone-box {
  text-align: center; padding: 20px; border-radius: 16px; background: var(--surface-3); margin-bottom: 16px;
}
.phone-box .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.phone-box .phone { font-size: 26px; font-weight: 800; letter-spacing: .5px; margin: 6px 0 10px; }
.countdown { font-size: 14px; color: var(--warn); font-weight: 700; }
.progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #7c5cff); transition: width .6s linear; }

.code-box {
  padding: 16px; border-radius: 14px; background: var(--ok-soft); border: 1px dashed var(--ok);
  text-align: center; margin-bottom: 14px;
}
.code-box .code { font-size: 30px; font-weight: 900; letter-spacing: 6px; color: var(--ok); }
.sms-item {
  padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 8px;
  font-size: 13.5px; word-break: break-word;
}
.sms-item .head { display: flex; gap: 8px; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }

/* ---------------- 提示 ---------------- */
.toast-box { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
.toast {
  padding: 11px 20px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-2); font-weight: 600; font-size: 14px; animation: toast-in .22s ease;
}
.toast.ok { border-color: var(--ok); color: var(--ok); }
.toast.err { border-color: var(--err); color: var(--err); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 26px 20px 40px; }

@media (max-width: 640px) {
  .hero { padding: 22px 18px; border-radius: 18px; }
  .hero h1 { font-size: 21px; }
  .wrap { padding: 16px 14px 60px; }
  .topbar-inner { padding: 10px 14px; }
  .brand span.name { display: none; }
  .phone-box .phone { font-size: 22px; }
}

/* ---------------- 取号工作台（左侧选择 / 右侧接码） ---------------- */
.buy-layout {
  display: grid;
  grid-template-columns: 348px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.pick-col { display: grid; gap: 16px; position: sticky; top: 68px; }
.recv-col { min-width: 0; }

.picker-list {
  margin-top: 10px;
  max-height: 318px;
  overflow: auto;
  display: grid;
  gap: 2px;
  padding-right: 4px;
  overscroll-behavior: contain;
}
.pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: .14s;
}
.pick-item:hover { background: var(--surface-3); }
.pick-item.active { background: var(--brand-soft); border-color: var(--brand); font-weight: 700; }
.pick-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}
.pick-price { font-weight: 800; color: var(--brand); font-size: 13.5px; white-space: nowrap; }
.pick-item .rate {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}
.pick-item .rate.good { color: var(--ok); background: var(--ok-soft); }
.pick-item .rate.mid { color: var(--warn); background: var(--warn-soft); }
.pick-item .rate.bad { color: var(--muted); }

.recv-empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.recv-empty h3 { color: var(--text); }
.order-summary { display: grid; gap: 9px; }
.order-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface-2);
  border-radius: 11px;
}
.modal-body .card { border: 0; box-shadow: none; padding: 0; background: transparent; }

@media (max-width: 900px) {
  .buy-layout { grid-template-columns: 1fr; }
  .pick-col { position: static; }
  .picker-list { max-height: 240px; }
}

/* ---------------- 左侧选择区视觉优化 ---------------- */
.pick-col .card { padding: 16px 16px 12px; }
.pick-col .card-head { margin-bottom: 10px; }
.pick-col .card-head h2 { font-size: 15px; }
.pick-col .card-head .sub { font-size: 12px; }
.pick-col input { padding: 8px 12px; font-size: 14px; }

.picker-list { gap: 3px; max-height: 300px; }
.picker-list::-webkit-scrollbar { width: 8px; }
.picker-list::-webkit-scrollbar-track { background: transparent; }
.picker-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid var(--surface); }
.picker-list::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.pick-item {
  padding: 8px 10px 8px 12px;
  border-left: 3px solid transparent;
  background: var(--surface-2);
}
.pick-item:hover { background: var(--surface-3); border-left-color: var(--line-strong); }
.pick-item.active {
  background: var(--brand-soft);
  border-left-color: var(--brand);
  box-shadow: none;
}
.pick-item.active .pick-name { color: var(--brand-700); }
html[data-theme="dark"] .pick-item.active .pick-name { color: #bcd0ff; }

.pick-name { font-size: 13.5px; font-weight: 600; }
.pick-item.active .pick-name { font-weight: 800; }
.pick-price {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--brand);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pick-price i { font-style: normal; font-weight: 600; font-size: 10.5px; color: var(--muted); margin-left: 1px; }
.pick-item .rate {
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 7px;
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pick-item .rate.good { color: var(--ok); background: var(--ok-soft); }
.pick-item .rate.mid { color: var(--warn); background: var(--warn-soft); }
.pick-item .rate.bad { color: var(--muted); background: var(--surface-3); }
.pick-col .chips .chip { font-size: 12.5px; padding: 5px 11px; }
