:root {
  --platform-bg: #eef4f8;
  --platform-surface: #fff;
  --platform-ink: #0c1d38;
  --platform-muted: #637189;
  --platform-line: #dce7f1;
  --platform-blue: #0798d2;
  --platform-blue-deep: #0b3b66;
  --platform-yellow: #ffc400;
  --platform-orange: #f47a32;
}

* {
  box-sizing: border-box;
}

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

body.embed-body {
  overflow: hidden;
  color: var(--platform-ink);
  background: var(--platform-bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.embed-body a {
  color: inherit;
  text-decoration: none;
}

.embed-shell {
  display: grid;
  min-height: 100svh;
  grid-template-rows: 68px minmax(0, 1fr);
}

.embed-header {
  position: relative;
  z-index: 10;
  display: flex;
  min-width: 0;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 40px);
  background: var(--platform-surface);
  border-bottom: 1px solid var(--platform-line);
  box-shadow: 0 8px 24px rgba(12, 43, 75, 0.06);
}

.embed-title,
.embed-actions,
.primary-action {
  display: flex;
  align-items: center;
}

.embed-title {
  min-width: 0;
  gap: 12px;
}

.embed-title > div {
  min-width: 0;
}

.embed-title p,
.embed-title h1 {
  margin: 0;
}

.embed-title p {
  color: var(--platform-blue);
  font-size: 11px;
  font-weight: 800;
}

.scratch-embed .embed-title p {
  color: var(--platform-orange);
}

.embed-title h1 {
  margin-top: 3px;
  overflow: hidden;
  font-size: 20px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-link {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  color: var(--platform-blue-deep);
  border: 1px solid var(--platform-line);
  border-radius: 6px;
  background: #f8fbfd;
  place-items: center;
}

.back-link:hover,
.back-link:focus-visible,
.embed-actions > a:not(.primary-action):hover,
.embed-actions > a:not(.primary-action):focus-visible {
  color: var(--platform-blue);
  background: #eaf7fc;
}

.back-link svg,
.primary-action svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.embed-actions {
  min-width: 0;
  gap: 6px;
}

.embed-actions > a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 13px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

.embed-actions .primary-action {
  gap: 7px;
  color: #fff;
  background: var(--platform-blue);
}

.scratch-embed .embed-actions .primary-action {
  background: var(--platform-orange);
}

.embed-actions .primary-action:hover,
.embed-actions .primary-action:focus-visible {
  filter: brightness(0.92);
}

.embed-workspace {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--platform-bg);
}

.embed-workspace iframe {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: calc(100svh - 68px);
  border: 0;
  background: transparent;
  opacity: 0;
  transition: opacity 180ms ease;
}

.frame-ready .embed-workspace iframe {
  opacity: 1;
}

.frame-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 13px;
  padding: 28px;
  color: var(--platform-blue-deep);
  background:
    radial-gradient(circle at 50% 34%, rgba(7, 152, 210, 0.14), transparent 32%),
    linear-gradient(145deg, #f8fcff, #eaf4fa);
  font-size: 14px;
  opacity: 1;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.frame-loading-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: #36516e;
  font-size: 12px;
  font-weight: 800;
}

.frame-loading-brand img {
  width: 116px;
  height: auto;
}

.frame-loading-orbit {
  display: grid;
  width: 66px;
  height: 66px;
  margin-bottom: 4px;
  border: 4px solid #c9deea;
  border-top-color: var(--platform-blue);
  border-radius: 50%;
  animation: platform-spin 0.9s linear infinite;
  place-items: center;
}

.frame-loading-orbit span {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--platform-yellow);
  box-shadow: 0 0 0 7px rgba(255, 196, 0, 0.16);
}

.scratch-embed .frame-loading-orbit {
  border-top-color: var(--platform-orange);
}

.frame-loading strong {
  font-size: 17px;
  line-height: 1.45;
}

.frame-loading-track {
  width: min(300px, 72vw);
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #d7e5ef;
}

.frame-loading-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--platform-blue), #17b6b0);
  transition: width 380ms ease;
}

.scratch-embed .frame-loading-track span {
  background: linear-gradient(90deg, var(--platform-orange), #ffc400);
}

.frame-loading b {
  min-width: 4ch;
  color: var(--platform-blue);
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.scratch-embed .frame-loading b {
  color: var(--platform-orange);
}

.frame-ready .frame-loading {
  visibility: hidden;
  opacity: 0;
}

body.redirect-body {
  display: grid;
  min-height: 100vh;
  margin: 0;
  padding: 24px;
  color: var(--platform-ink);
  background: var(--platform-bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  place-items: center;
}

.redirect-panel {
  width: min(520px, 100%);
  padding: 42px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--platform-line);
  border-top: 5px solid #12a67d;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(12, 43, 75, 0.08);
}

.redirect-icon {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 22px;
  color: #12a67d;
  background: #e8f7f2;
  border-radius: 8px;
  place-items: center;
}

.redirect-icon svg {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.redirect-panel h1 {
  margin: 0;
  font-size: 32px;
}

.redirect-panel p {
  margin: 14px 0 26px;
  color: var(--platform-muted);
  line-height: 1.8;
}

.redirect-button,
.redirect-back {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.redirect-button {
  color: #fff;
  background: #12a67d;
}

.redirect-back {
  margin-top: 10px;
  color: var(--platform-blue-deep);
  border: 1px solid var(--platform-line);
}

@keyframes platform-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 720px) {
  .embed-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .embed-header {
    min-height: 68px;
    gap: 10px;
    padding: 9px 12px;
  }

  .embed-title h1 {
    max-width: 44vw;
    font-size: 16px;
  }

  .embed-title p {
    display: none;
  }

  .embed-actions > a:not(.primary-action) {
    display: none;
  }

  .embed-actions .primary-action {
    min-height: 40px;
    padding: 0 11px;
    font-size: 12px;
  }

  .embed-workspace iframe {
    height: calc(100svh - 68px);
  }

  .redirect-panel {
    padding: 32px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .frame-loading-orbit {
    animation: none;
  }

  .embed-workspace iframe {
    transition: none;
  }
}
