:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f4f6f9;
  font-synthesis: none;
  --topbar-height: 64px;
  --line: #e4e8ee;
  --muted: #697386;
  --accent: #176b5b;
  --accent-soft: #e8f3ef;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  min-height: 320px;
  background: #ffffff;
}

.topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  min-width: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 1px 7px rgba(23, 32, 51, 0.04);
}

.brand {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 10px;
  height: 44px;
  padding-right: 22px;
  color: #172033;
  text-decoration: none;
}

.brand__mark {
  display: block;
  flex: 0 0 auto;
  border-radius: 8px;
}

.brand__name {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0;
}

.site-tabs {
  min-width: 0;
  overflow: hidden;
}

.site-tabs__track {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
}

.site-tabs__track::-webkit-scrollbar {
  display: none;
}

.site-tab {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 92px;
  height: 100%;
  padding: 0 15px;
  border: 0;
  color: #657084;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease;
}

.site-tab::after {
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--tab-color, var(--accent));
  content: "";
  opacity: 0;
  transform: scaleX(0.55);
  transition: opacity 160ms ease, transform 160ms ease;
}

.site-tab:hover {
  color: #172033;
  background: #f7f9fb;
}

.site-tab:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid rgba(23, 107, 91, 0.22);
  outline-offset: -3px;
}

.site-tab[aria-selected="true"] {
  color: #172033;
  font-weight: 650;
  background: color-mix(in srgb, var(--tab-color, var(--accent)) 8%, white);
}

.site-tab[aria-selected="true"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.site-tab__badge {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: #ffffff;
  background: var(--tab-color, var(--accent));
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.site-tab__label {
  font-size: 14px;
  letter-spacing: 0;
}

.actions {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 4px;
  padding-left: 12px;
}

.social-menu {
  position: relative;
}

.social-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 12px);
  right: -84px;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100dvh - 76px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid #dfe4e9;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(23, 32, 51, 0.16), 0 3px 12px rgba(23, 32, 51, 0.08);
}

.social-popover[hidden] {
  display: none;
}

.social-popover::before,
.social-popover::after {
  position: absolute;
  right: 110px;
  width: 0;
  height: 0;
  border-right: 8px solid transparent;
  border-left: 8px solid transparent;
  content: "";
}

.social-popover::before {
  top: -9px;
  border-bottom: 9px solid #dfe4e9;
}

.social-popover::after {
  top: -8px;
  border-bottom: 9px solid #ffffff;
}

.social-popover__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.social-popover__header h2 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 0;
}

.social-popover__header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.close-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: -5px -5px 0 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #707b8d;
  background: transparent;
  cursor: pointer;
}

.close-button:hover {
  color: #172033;
  background: #f0f3f6;
}

.close-button svg,
.channel-mark svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.wechat-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid #e5e9ed;
  border-radius: 8px;
  background: #fafbfc;
}

.wechat-card__meta,
.telegram-link {
  display: flex;
  align-items: center;
  min-width: 0;
}

.wechat-card__meta {
  gap: 10px;
}

.wechat-card__meta > span:last-child,
.telegram-link__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.wechat-card strong,
.telegram-link strong {
  overflow: hidden;
  font-size: 14px;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wechat-card small,
.telegram-link small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.channel-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
}

.channel-mark--wechat {
  color: #148b53;
  background: #e6f5ed;
}

.channel-mark--telegram {
  color: #2779a7;
  background: #e9f4f9;
}

.channel-mark--telegram svg {
  fill: currentColor;
  stroke: none;
}

.wechat-qr {
  width: 126px;
  aspect-ratio: 1;
  padding: 5px;
  border: 1px solid #dce2e7;
  border-radius: 6px;
  background: #ffffff;
}

.wechat-qr img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.social-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 13px 0;
  color: #98a1af;
  font-size: 10px;
}

.social-divider::before,
.social-divider::after {
  flex: 1;
  height: 1px;
  background: #e7eaee;
  content: "";
}

.telegram-link {
  width: 100%;
  min-height: 58px;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e9ed;
  border-radius: 8px;
  color: #172033;
  background: #ffffff;
  text-align: left;
  text-decoration: none;
}

.telegram-link:hover {
  border-color: #b9c9db;
  background: #f7faff;
}

.telegram-link:focus-visible {
  outline: 2px solid #229ed9;
  outline-offset: 2px;
}

.telegram-link__text {
  flex: 1;
}

.telegram-link__status {
  flex: 0 0 auto;
  color: #8993a3;
  font-size: 11px;
}

.support-card {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.support-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.support-card p,
.support-card small {
  display: block;
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.support-code {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 7px;
}

.support-code:focus-visible {
  outline: 3px solid rgba(23, 107, 91, 0.35);
  outline-offset: 3px;
}

.support-code img {
  display: block;
  width: 100%;
  height: auto;
}

.support-card small {
  margin: 8px 0 0;
  text-align: center;
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: #5f6a7c;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: color 150ms ease, background-color 150ms ease;
}

.icon-button.social-button {
  width: auto;
  min-width: 66px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.icon-button:hover {
  color: #172033;
  background: #f0f3f6;
}

.icon-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.workspace,
.frame-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #f4f6f9;
}

.frame-stage {
  width: 100%;
  height: 100%;
}

.site-frames,
.site-frame {
  display: block;
  width: 100%;
  height: 100%;
}

.site-frame {
  border: 0;
  background: #ffffff;
}

.site-frame[hidden] {
  display: none;
}

.loading-bar {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.loading-bar::after {
  display: block;
  width: 36%;
  height: 100%;
  background: var(--accent);
  content: "";
  transform: translateX(-110%);
}

.loading-bar.is-loading {
  opacity: 1;
}

.loading-bar.is-loading::after {
  animation: loading-slide 1s ease-in-out infinite;
}

@keyframes loading-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(380%); }
}

noscript {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #172033;
  background: #ffffff;
}

noscript h1 { margin: 0 0 12px; font-size: 24px; }
noscript p { margin: 0 0 16px; }
noscript nav { display: flex; flex-wrap: wrap; gap: 12px; }
noscript nav a { color: #176b5b; }

@media (max-width: 720px) {
  :root {
    --topbar-height: 58px;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 0 8px;
  }

  .brand {
    gap: 0;
    padding-right: 8px;
  }

  .brand__mark {
    width: 30px;
    height: 30px;
  }

  .brand__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .site-tab {
    min-width: auto;
    padding: 0 12px;
  }

  .site-tab__badge {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    font-size: 10px;
  }

  .site-tab__label {
    font-size: 13px;
  }

  .actions {
    padding-left: 4px;
  }

  .social-popover {
    position: fixed;
    top: 66px;
    right: 8px;
    left: 8px;
    width: auto;
  }

  .social-popover::before,
  .social-popover::after {
    right: 80px;
  }

  .icon-button {
    width: 36px;
    height: 36px;
  }

  #refresh-button {
    display: none;
  }
}

@media (max-width: 390px) {
  .wechat-card {
    grid-template-columns: 1fr;
  }

  .wechat-qr {
    justify-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
