:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #6b7280;
  --line: #e7ebf1;
  --brand: #0d9488;
  --brand-2: #0891b2;
  --brand-soft: #e9f7f5;
  --amber: #b45309;
  --amber-soft: #fef3e2;
  --ok: #16a34a;
  --err: #e11d48;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 20px rgba(16,24,40,.06);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
a { color: inherit; text-decoration: none; }
b { font-weight: 600; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  color: #fff; box-shadow: 0 2px 12px rgba(8,145,178,.25);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: .2px; color: #fff; }
.nav-link { color: #eafffb; font-size: 14px; padding: 6px 12px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; }
.nav-link:hover { background: rgba(255,255,255,.15); }

.mock-banner { background: #fff7ed; color: #9a3412; border-bottom: 1px solid #fed7aa; text-align: center; font-size: 13px; padding: 8px 12px; }

main.wrap { min-height: 60vh; padding-top: 18px; padding-bottom: 28px; }
.loading { color: var(--muted); text-align: center; padding: 60px 0; }
.footer { color: var(--muted); font-size: 13px; padding: 22px 16px 40px; text-align: center; }

/* hero + filters */
.hero { margin-bottom: 14px; }
.hero h1 { font-size: 22px; margin: 4px 0 2px; }
.hero p { color: var(--muted); margin: 0; font-size: 14px; }

.filters { position: sticky; top: 56px; z-index: 10; background: var(--bg); padding: 12px 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pills { display: inline-flex; background: #eef1f6; border-radius: 999px; padding: 3px; }
.pill { border: 0; background: transparent; color: var(--muted); padding: 7px 16px; border-radius: 999px; font-size: 14px; cursor: pointer; font-weight: 500; }
.pill.on { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.filters select, .filters input {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 12px; font-size: 14px; color: var(--ink);
  outline: none; min-height: 38px;
}
.filters select:focus, .filters input:focus { border-color: var(--brand); }
.filters .search { flex: 1; min-width: 140px; }
.count { color: var(--muted); font-size: 13px; margin-left: auto; }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(16,24,40,.10); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge.data { background: var(--brand-soft); color: var(--brand); }
.badge.reg { background: var(--amber-soft); color: var(--amber); }
.region { font-size: 13px; color: var(--muted); }
.card h3 { margin: 0; font-size: 16px; font-weight: 650; }
.spec { display: flex; gap: 14px; color: var(--muted); font-size: 13px; }
.spec b { color: var(--ink); font-weight: 600; }
.flags { font-size: 15px; letter-spacing: 1px; }
.flags .more { font-size: 12px; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.card-bot { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.price { font-size: 22px; font-weight: 750; color: var(--ink); }
.price .u { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.price .cny { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.btn {
  border: 0; border-radius: 10px; padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
  background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.block { width: 100%; padding: 13px; font-size: 15px; }
.empty { text-align: center; color: var(--muted); padding: 50px 0; }

/* bottom sheet (detail) */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; } /* 确保 hidden 属性能盖过 display:flex */
.sheet-mask { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.sheet-body {
  position: relative; background: #fff; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 20px; box-shadow: 0 -10px 40px rgba(0,0,0,.2);
  animation: slideup .22s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) { .sheet { align-items: center; } .sheet-body { border-radius: 18px; } }
.sheet h2 { margin: 0 0 2px; font-size: 19px; }
.sheet .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.kv { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv .k { color: var(--muted); width: 84px; flex: none; }
.kv .v { color: var(--ink); }
.note { background: var(--amber-soft); color: var(--amber); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 12px 0; }
.countries { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #f1f5f9; border-radius: 8px; padding: 4px 9px; font-size: 13px; }
.sheet-foot { position: sticky; bottom: -20px; background: #fff; padding-top: 14px; margin-top: 12px; }
.x { position: absolute; right: 14px; top: 12px; border: 0; background: #f1f5f9; width: 32px; height: 32px; border-radius: 999px; font-size: 18px; cursor: pointer; color: var(--muted); }

/* order / payment */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); max-width: 520px; margin: 0 auto; }
.panel h2 { margin: 0 0 4px; font-size: 19px; }
.status-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 16px; }
.dot { width: 10px; height: 10px; border-radius: 999px; flex: none; }
.dot.wait { background: var(--amber); animation: pulse 1.2s infinite; }
.dot.work { background: var(--brand); animation: pulse 1s infinite; }
.dot.ok { background: var(--ok); }
.dot.err { background: var(--err); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.pay-amt { text-align: center; margin: 8px 0 4px; }
.pay-amt .n { font-size: 34px; font-weight: 800; color: var(--ink); }
.pay-amt .u { font-size: 14px; color: var(--muted); font-weight: 600; }
.pay-hint { text-align: center; color: var(--err); font-size: 13px; margin-bottom: 14px; }
.qrbox { display: flex; justify-content: center; margin: 8px 0 14px; }
.qrbox img { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
.copyrow { display: flex; align-items: center; gap: 8px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.copyrow .lbl { color: var(--muted); font-size: 12px; }
.copyrow .val { font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; flex: 1; }
.copyrow button { border: 0; background: var(--brand-soft); color: var(--brand); border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.countdown { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.countdown b { color: var(--ink); font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 13px; }
.big-ok { font-size: 40px; text-align: center; }
.esim-qr { display: flex; justify-content: center; margin: 12px 0; }
.esim-qr img { width: 240px; height: 240px; border-radius: 12px; border: 1px solid var(--line); }
.steps { font-size: 13px; color: var(--muted); padding-left: 18px; margin: 10px 0; }
.steps li { margin: 4px 0; }
.usage-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 12px; }
.usage-bar { height: 8px; background: #e7ebf1; border-radius: 999px; overflow: hidden; margin: 8px 0; }
.usage-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.spin { width: 34px; height: 34px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 999px; animation: rot .8s linear infinite; margin: 16px auto; }
@keyframes rot { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 99; opacity: 0; transition: opacity .2s; }
.toast.show { opacity: .95; }
.back { display: inline-block; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
