:root {
  --page-bg: #edf1f4;
  --card-bg: #ffffff;
  --card-border: #dbe2e7;
  --title: #222222;
  --subtitle: #6d7986;
  --blue: #2f62a3;
  --blue-soft: #4a76ad;
  --green: #6dc13b;
  --green-soft: #dff1d2;
  --link: #3b64a3;
  --loading-bg: #f5f2eb;
  --loading-track: #d9d9d9;
  --loading-fill: #18f400;
  --notice-red: #ff5757;
  --notice-soft: #fff5ea;
  --notice-border: #e3e3e3;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background: #edf4f7;
}

body {
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--title);
}

body.is-loading,
body.is-notice {
  background: var(--loading-bg);
}

body.is-sites {
  background: #eaf2f5;
}

.flow-view[hidden] {
  display: none;
}

.loading-page,
.notice-page,
.sites-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.sites-page {
  align-items: center;
  padding: 40px 24px;
  overflow-x: hidden;
  position: relative;
}

.sites-page::before {
  content: none;
}

.sites-shell {
  width: min(100%, 470px);
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
}

.sites-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 78px;
  padding: 4px 10px;
  margin-bottom: 50px;
  text-align: left;
}

.sites-brand__logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  object-fit: cover;
  background: #ffffff;
  box-shadow: 0 14px 26px rgba(47, 98, 163, 0.14);
  flex: 0 0 auto;
}

.sites-brand__text {
  min-width: 0;
}

.sites-brand__text h1 {
  margin: 0;
  color: #1f2a35;
  font-size: 1.65rem;
  line-height: 1.15;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.sites-brand__text p {
  margin: 7px 0 0;
  color: #667784;
  font-size: 0.95rem;
  line-height: 1.4;
}

.loading-card {
  width: min(100%, 320px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.progress-value {
  font-size: clamp(3rem, 12vw, 4.2rem);
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0;
  color: #8f8f8f;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--loading-track);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #12eb00 0%, var(--loading-fill) 100%);
  transition: width 0.18s linear;
}

.loading-text {
  margin: 4px 0 0;
  font-size: clamp(1.5rem, 5vw, 1.95rem);
  line-height: 1.35;
  color: #222222;
}

.notice-panel {
  width: min(100%, 360px);
  border: 1px solid var(--notice-border);
  border-radius: 12px;
  background: var(--card-bg);
  padding: 18px 12px 16px;
}

.notice-title {
  margin: 0 0 20px;
  text-align: center;
  font-size: clamp(1.75rem, 7vw, 2rem);
  font-weight: 700;
  color: var(--notice-red);
}

.notice-highlight {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px;
  border-radius: 6px;
  background: var(--notice-soft);
}

.notice-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding-bottom: 2px;
  border-left: 2px solid #f0563e;
  border-bottom: 2px solid #f0563e;
}

.notice-icon__line {
  width: 4px;
  height: 7px;
  background: #f0563e;
}

.notice-icon__line--mid {
  height: 12px;
}

.notice-icon__line--high {
  height: 16px;
}

.notice-highlight__text {
  margin: 0;
  font-size: 0.95rem;
  color: #333333;
}

.notice-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.notice-status__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #59c53d;
  flex: 0 0 auto;
  position: relative;
}

.notice-status__dot::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 2px;
  width: 4px;
  height: 7px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.notice-status__text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--title);
}

.notice-footer {
  margin-top: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.notice-footer__text {
  margin: 0;
  font-size: 0.92rem;
  color: #8f8f8f;
  line-height: 1.5;
  max-width: 172px;
}

.notice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--notice-red);
  border-radius: 999px;
  background: transparent;
  color: var(--notice-red);
  font: inherit;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.sites-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  padding: 82px 28px 28px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 253, 254, 0.98) 100%);
  border: 1px solid rgba(198, 214, 224, 0.9);
  box-shadow: 0 24px 58px rgba(64, 89, 117, 0.16);
  backdrop-filter: blur(8px);
}

.sites-badge {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(64, 89, 117, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sites-badge__shield {
  width: 58px;
  height: 58px;
  display: block;
}

.site-list {
  display: grid;
  gap: 10px;
  padding: 2px 0;
}

.detect-status {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  margin: 0 0 2px;
  padding: 7px 14px;
  border: 1px solid #d9e8f8;
  border-radius: 999px;
  background: #f1f7ff;
  color: #3f6fae;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 8px 18px rgba(63, 111, 174, 0.08);
}

.detect-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(83, 127, 185, 0.12);
  flex: 0 0 auto;
}

.detect-status.is-complete {
  border-color: #d7ebdc;
  background: #f2fbf5;
  color: #34835a;
  box-shadow: 0 8px 18px rgba(52, 131, 90, 0.08);
}

.detect-status.is-empty {
  border-color: #e6e1d4;
  background: #fff9ed;
  color: #8a6a2f;
  box-shadow: 0 8px 18px rgba(138, 106, 47, 0.08);
}

.site-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.site-item:hover {
  background: rgba(237, 243, 248, 0.64);
}

.site-item:focus-visible {
  outline: 2px solid var(--blue-soft);
  outline-offset: 3px;
}

.site-status {
  display: inline-flex;
  align-items: center;
  color: var(--blue);
  font-size: 0.95rem;
}

.site-domain {
  color: var(--link);
  font-size: 0.95rem;
  word-break: break-all;
}

.copy-button {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #6e8fc0;
  cursor: pointer;
  position: relative;
}

.copy-button::before,
.copy-button::after {
  content: "";
  position: absolute;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.copy-button::before {
  width: 10px;
  height: 12px;
  left: 7px;
  top: 5px;
  background: #ffffff;
}

.copy-button::after {
  width: 10px;
  height: 12px;
  left: 3px;
  top: 9px;
  background: transparent;
}

.go-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(80%, 360px);
  align-self: center;
  margin-top: 0;
  min-height: 54px;
  padding: 0 16px;
  border: none;
  border-radius: 7px;
  background: linear-gradient(180deg, #537fb9 0%, var(--blue-soft) 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(47, 98, 163, 0.18);
  transition: opacity 0.2s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

a.go-button,
a.go-button:hover,
a.go-button:focus,
a.go-button:visited {
  color: #ffffff;
  text-decoration: none;
}

.go-button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 24px rgba(47, 98, 163, 0.22);
}

.go-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.contact-button {
  background: linear-gradient(180deg, #537fb9 0%, var(--blue-soft) 100%);
  box-shadow: 0 10px 20px rgba(47, 98, 163, 0.18);
}

.action-brand {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  max-width: 100%;
  margin: 2px 0 0;
  color: #18a45b;
  font-size: clamp(1.4rem, 7vw, 2.05rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
}

.action-brand__logo {
  width: min(260px, 80vw);
  height: auto;
  border-radius: 0;
  object-fit: contain;
}

.action-brand__logo--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.action-brand__logo svg {
  display: block;
  width: 100%;
  height: 100%;
}

.action-brand__text {
  min-width: 0;
  max-width: 260px;
  overflow-wrap: anywhere;
}

.sites-utility {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
  padding-top: 20px;
  position: relative;
}

.sites-utility::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(219, 226, 231, 0), rgba(219, 226, 231, 0.95), rgba(219, 226, 231, 0));
}

.sites-utility > :only-child {
  grid-column: 1 / -1;
}

.utility-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid #dce6ee;
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--link);
  font-size: 0.92rem;
  line-height: 1.35;
  text-decoration: none;
  word-break: break-all;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.utility-item.is-copyable {
  cursor: pointer;
}

.utility-item:hover {
  border-color: #c7d7e5;
  background: #ffffff;
  transform: translateY(-1px);
}

.utility-item:focus-visible {
  outline: 2px solid var(--blue-soft);
  outline-offset: 3px;
}

.utility-label {
  flex: 0 0 auto;
  color: var(--subtitle);
  font-size: 0.82rem;
}

.utility-value {
  min-width: 0;
  max-width: 100%;
  text-align: left;
  color: var(--link);
}

.sites-notice {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #e2ebf2;
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--subtitle);
  font-size: 0.88rem;
  line-height: 1.55;
  text-align: center;
}

.qr-cache {
  margin-top: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.qr-box {
  width: 104px;
  flex: 0 0 104px;
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px dashed #d8e4ec;
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--subtitle);
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: center;
}

.tg-account {
  min-width: 0;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid #d8e4ec;
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--subtitle);
  text-decoration: none;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.tg-account:hover {
  border-color: #c7d7e5;
  background: #ffffff;
  transform: translateY(-1px);
}

.tg-account:focus-visible {
  outline: 2px solid var(--blue-soft);
  outline-offset: 3px;
}

.tg-account__label {
  color: var(--subtitle);
  font-size: 0.82rem;
  line-height: 1.25;
}

.tg-account__value {
  color: var(--link);
  font-size: 0.95rem;
  line-height: 1.35;
  word-break: break-all;
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(34, 34, 34, 0.92);
  color: #ffffff;
  font-size: 0.9rem;
  z-index: 10;
}

@media (max-width: 430px) {
  .loading-page,
  .notice-page {
    padding: 16px;
  }

  .sites-page {
    padding: 28px 16px;
  }

  .sites-shell {
    gap: 14px;
  }

  .sites-brand {
    justify-content: flex-start;
    min-height: 66px;
  }

  .sites-brand__logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .sites-brand__text h1 {
    font-size: 1.35rem;
  }

  .sites-card {
    padding: 78px 18px 20px;
  }

  .sites-utility {
    grid-template-columns: 1fr;
  }

  .qr-cache {
    align-items: stretch;
    gap: 10px;
  }

  .tg-account {
    flex-basis: 0;
    padding: 12px;
    text-align: left;
  }

  .qr-box {
    width: 96px;
    flex-basis: 96px;
    min-height: 96px;
  }

  .loading-card {
    width: min(100%, 280px);
    gap: 18px;
  }

  .progress-track {
    height: 9px;
  }

  .loading-text {
    font-size: clamp(1.2rem, 5.8vw, 1.5rem);
  }

  .notice-panel {
    width: 100%;
    padding: 16px 10px 14px;
  }

  .notice-title {
    margin-bottom: 18px;
  }

  .notice-footer {
    margin-top: 40px;
  }
}

@media (max-width: 380px) {
  .sites-page {
    padding: 16px;
  }

  .sites-card {
    width: 100%;
    padding: 74px 16px 18px;
  }

  .site-item {
    grid-template-columns: 84px minmax(0, 1fr) 24px;
    gap: 8px;
    padding-left: 4px;
    padding-right: 4px;
  }

  .utility-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .utility-value {
    text-align: left;
  }
}

@media (max-width: 360px) {
  .notice-highlight {
    padding: 14px 12px;
  }

  .notice-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .notice-footer__text {
    max-width: none;
  }

  .notice-button {
    width: 100%;
  }
}

@media (max-width: 320px) {
  .loading-card {
    width: 100%;
  }

  .progress-track {
    height: 8px;
  }
}
