:root {
  --ink: #0f172a;
  --ink2: #475569;
  --muted: #7b8798;
  --line: #e5eaf2;
  --blue: #2563eb;
  --blue2: #1d4ed8;
  --green: #0f8f62;
  --red: #c73535;
  --bg: #f3f6fb;
  --card: #ffffff;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.12), transparent 34%),
    radial-gradient(circle at 0% 100%, rgba(14, 165, 233, 0.09), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.page {
  width: min(100%, 440px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 4px 16px;
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
  flex: 0 0 auto;
}
.brand-logo {
  background: #fff;
  object-fit: contain;
  padding: 2px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}
.brand h1 { margin: 0; font-size: 19px; letter-spacing: .01em; line-height: 1.45; }
.brand p { margin: 1px 0 0; color: var(--muted); font-size: 12px; }
.scope-inline {
  margin: 4px 0 0 !important;
  color: var(--blue) !important;
  font-size: 11px !important;
}
#unlimited-suffix {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 4px;
  white-space: normal;
  vertical-align: middle;
}
.rule-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border: 1px solid #bcd4f3;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.rule-chip:hover { background: #e0efff; border-color: var(--blue); }
.phone-input:disabled { background: #f2f5f9; color: #5a6b7d; }
#form-change-phone-btn { margin: 4px 0 2px; align-self: flex-start; }
#form-captcha-img { margin: 8px 0; max-width: 160px; border-radius: 8px; }
#scope-btn { margin-left: 4px; vertical-align: middle; }
.speed-rule-link {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.speed-rule-modal { width: min(100%, 460px); max-height: 88dvh; display: flex; flex-direction: column; }
.speed-rule-modal .modal-body { overflow: auto; }
.speed-rule-disclaimer {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #f0d39a;
  background: #fffaf0;
  color: #855400;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.6;
}
.speed-rule-intro { margin: 0 0 10px; color: var(--ink2); font-size: 13px; line-height: 1.65; }
.speed-rule-search {
  width: 100%;
  height: 40px;
  border: 1px solid #d7dfeb;
  border-radius: 9px;
  background: #fbfdff;
  padding: 0 11px;
  outline: none;
  font-size: 13px;
  margin-bottom: 6px;
}
.speed-rule-search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.speed-rule-count { color: var(--muted); font-size: 11px; margin: 0 0 6px; }
.speed-rule-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.speed-rule-head,
.speed-rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
  align-items: center;
  padding: 8px 11px;
}
.speed-rule-head { background: #f7f9fd; color: var(--ink2); font-size: 11px; }
.speed-rule-head strong { text-align: right; }
.speed-rule-list { max-height: 42dvh; overflow: auto; }
.speed-rule-row { border-top: 1px solid var(--line); font-size: 13px; }
.speed-rule-row:first-child { border-top: none; }
.speed-rule-row span { min-width: 0; overflow-wrap: anywhere; }
.speed-rule-row small { display: block; color: var(--muted); font-size: 10px; line-height: 1.35; margin-top: 1px; }
.speed-rule-row strong { color: var(--red); text-align: right; white-space: nowrap; }
.speed-rule-notes { margin: 0; padding-left: 18px; color: var(--ink2); font-size: 12px; line-height: 1.8; }
.speed-rule-source { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }

.scope-modal { width: min(100%, 460px); max-height: 88dvh; display: flex; flex-direction: column; }
.scope-modal .modal-body { overflow: auto; }
.scope-note { margin: 0 0 9px; color: var(--muted); font-size: 11px; }
.scope-search {
  width: 100%;
  height: 40px;
  border: 1px solid #d7dfeb;
  border-radius: 9px;
  background: #fbfdff;
  padding: 0 11px;
  outline: none;
  font-size: 13px;
  margin-bottom: 6px;
}
.scope-search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.scope-count { color: var(--muted); font-size: 11px; margin: 0 0 8px; }
.scope-section { margin-bottom: 12px; }
.scope-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink2);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}
.scope-section-title span { color: var(--muted); font-size: 10px; font-weight: 600; }
.scope-regions { display: flex; flex-wrap: wrap; gap: 5px; }
.scope-chip {
  display: inline-block;
  border: 1px solid #dbe5f2;
  background: #f7faff;
  color: var(--ink2);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.scope-source { margin: 12px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }

.panel {
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.09);
  padding: 22px 18px 20px;
  min-height: 290px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  min-height: 200px;
}

.field-label {
  display: block;
  margin: 0 0 7px;
  font-size: 12px;
  color: var(--ink2);
  font-weight: 700;
}

.phone-input,
.code-input {
  width: 100%;
  height: 52px;
  border: 1px solid #d7dfeb;
  border-radius: 13px;
  background: #fbfdff;
  padding: 0 14px;
  outline: none;
  font-size: 17px;
  letter-spacing: .04em;
  transition: border-color .15s, box-shadow .15s;
}
.phone-input { font-family: Consolas, "Courier New", monospace; letter-spacing: .09em; }
.code-input { font-family: Consolas, "Courier New", monospace; letter-spacing: .22em; font-size: 20px; }
.code-line { display: flex; align-items: stretch; gap: 8px; }
.code-line .code-input { flex: 1 1 auto; width: auto; min-width: 0; }
.code-send-btn {
  flex: 0 0 108px;
  border: 1px solid #b9d3f3;
  border-radius: 13px;
  background: #eef6ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  padding: 0 6px;
}
.code-send-btn:hover:not(:disabled) { background: #e0efff; border-color: var(--blue); }
.code-send-btn:disabled { opacity: .55; }
.code-send-btn.is-loading {
  color: transparent;
  position: relative;
  pointer-events: none;
}
.code-send-btn.is-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17px;
  height: 17px;
  margin: -10px 0 0 -10px;
  border: 2px solid #b9d3f3;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: code-spin .7s linear infinite;
}
@keyframes code-spin { to { transform: rotate(360deg); } }
.phone-input:disabled { background: #f1f5fb; color: var(--muted); cursor: not-allowed; }
.phone-input:focus,
.code-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.primary-btn {
  width: 100%;
  height: 50px;
  margin-top: 13px;
  border: none;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--blue), #0ea5e9);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 9px 20px rgba(37, 99, 235, 0.22);
  transition: opacity .15s, transform .05s;
}
.primary-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.primary-btn:active:not(:disabled) { transform: translateY(1px); }

.sent-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--green);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.check-dot {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: #e3f7ee;
  font-size: 12px;
}
#code-phone { text-align: center; margin: 0 0 15px; }

.notice-box {
  max-height: 190px;
  overflow: auto;
  background: #fffaf0;
  border: 1px solid #f0d39a;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 14px;
}
.notice-box strong {
  display: block;
  color: #8a5a00;
  font-size: 12px;
  margin-bottom: 4px;
}
.notice-box #notice-content {
  color: var(--ink2);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.captcha {
  display: block;
  width: 100%;
  max-height: 86px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  margin-bottom: 13px;
}

.error-text {
  margin: 10px 0 0;
  color: var(--red);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.center { text-align: center; }
.state-icon {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
}
.state-icon.waiting { background: #eef4ff; }
.state-icon.good { background: #e3f7ee; color: var(--green); }
.state-icon.bad { background: #fdeaea; color: var(--red); }
.center h2 { margin: 0; font-size: 19px; }
.center p { margin: 7px 0 0; font-size: 13px; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(37, 99, 235, 0.25);
  border-top-color: var(--blue);
  border-radius: 50%;
  display: inline-block;
  animation: spin .8s linear infinite;
}
.spinner.big { width: 34px; height: 34px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.footer {
  text-align: center;
  color: #9aa5b5;
  font-size: 11px;
  margin: 14px 0 0;
}

.info-card {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 15px;
}
.info-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink2);
  margin-bottom: 8px;
}
.info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-top: 1px dashed rgba(226, 232, 240, 0.9);
  font-size: 12px;
}
.info-row:first-of-type { border-top: none; }
.info-row span { color: var(--muted); white-space: nowrap; }
.info-row strong { font-weight: 700; color: var(--ink); text-align: right; overflow-wrap: anywhere; }

.link-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 11px;
  padding: 0 0 0 6px;
  white-space: nowrap;
}
.ghost-btn {
  width: 100%;
  height: 40px;
  margin-top: 10px;
  border: 1px solid #cfdaea;
  border-radius: 11px;
  background: #fff;
  color: var(--ink2);
  font-weight: 700;
  font-size: 13px;
}
.ghost-btn:hover { border-color: var(--blue); color: var(--blue); }
.change-hint {
  margin: 8px 0 0;
  color: #9a6700;
  background: #fff8e6;
  border: 1px solid #f0d39a;
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 12px;
}
.form-hint { margin: 6px 0 0; color: var(--muted); font-size: 11px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.48);
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal {
  width: min(100%, 390px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 6px;
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 8px 18px 14px; }
.warning-text { margin: 0 0 8px; color: var(--red); font-weight: 700; line-height: 1.65; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}
.btn {
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  background: #fff;
  color: var(--ink2);
  padding: 9px 14px;
  font-weight: 700;
  font-size: 13px;
}
.btn.primary { border-color: transparent; background: var(--blue); color: #fff; }
.btn.ghost { background: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.instructions {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 11px 15px;
  font-size: 12px;
  color: var(--ink2);
}
.instructions summary {
  cursor: pointer;
  list-style: none;
  font-weight: 800;
  color: var(--ink2);
  user-select: none;
}
.instructions summary::-webkit-details-marker { display: none; }
.instructions summary::after {
  content: "+";
  float: right;
  color: var(--muted);
  font-weight: 600;
}
.instructions[open] summary::after { content: "−"; }
.instructions ol {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.75;
}
.instructions li { margin: 2px 0; }

@media (min-width: 680px) {
  .page { padding-top: 40px; padding-bottom: 40px; }
  .panel { padding: 28px 26px 24px; min-height: 320px; }
  .brand { padding-bottom: 20px; }
}

@media (max-width: 360px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .panel { padding: 18px 14px 16px; border-radius: 17px; }
  .phone-input, .code-input { height: 48px; font-size: 16px; }
}
