:root {
  color-scheme: light;
  --shell-text: #14324d;
  --shell-text-soft: rgba(20, 50, 77, 0.72);
  --shell-border: rgba(255, 255, 255, 0.72);
  --shell-shadow: none;
  --glass-panel: transparent;
  --glass-overlay: rgba(250, 253, 255, 0.94);
  --progress-track: rgba(255, 255, 255, 0.74);
  --progress-fill-start: #75bfff;
  --progress-fill-mid: #8fd6ff;
  --progress-fill-end: #a8b8ff;
  --toolbar-bg: rgba(12, 22, 37, 0.74);
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 12%, rgba(224, 229, 233, 0.18), transparent 30%),
    radial-gradient(circle at 84% 20%, rgba(229, 235, 238, 0.2), transparent 26%),
    linear-gradient(180deg, #ffffff 0%, #fbfcfd 52%, #f7f9fa 100%);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  position: relative;
}

#unity-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 16%, rgba(226, 232, 235, 0.14), transparent 24%),
    radial-gradient(circle at 78% 24%, rgba(231, 237, 239, 0.15), transparent 25%),
    radial-gradient(circle at 66% 84%, rgba(221, 228, 232, 0.12), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #231F20;
  outline: none;
  box-shadow: none;
}

#unity-canvas:focus,
#unity-canvas:focus-visible {
  outline: none;
  box-shadow: none;
}

/* 幕布揭开时 canvas 从轻微放大+压暗处呼吸着落回原位 */
.unity-shell.is-revealing #unity-canvas {
  /* 延迟 350ms 再开始呼吸，等幕布开始拉开时画面才进入视野 */
  animation: canvasReveal 1150ms cubic-bezier(0.22, 1, 0.36, 1) 350ms both;
}

@keyframes canvasReveal {
  from {
    transform: scale(1.045);
    filter: brightness(0.9);
  }

  to {
    transform: scale(1);
    filter: brightness(1);
  }
}

#unity-warning {
  position: fixed;
  top: 24px;
  left: 50%;
  z-index: 50;
  display: none;
  width: min(560px, calc(100vw - 32px));
  transform: translateX(-50%);
}

.unity-warning-item {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  background: rgba(255, 255, 255, 0.82);
  color: var(--shell-text);
  box-shadow: 0 18px 40px rgba(70, 117, 168, 0.16);
  backdrop-filter: blur(18px);
}

.unity-warning-item.is-error {
  border-color: rgba(255, 123, 123, 0.4);
  background: rgba(255, 244, 244, 0.9);
}

.unity-warning-item.is-warning {
  border-color: rgba(255, 197, 112, 0.42);
  background: rgba(255, 249, 238, 0.9);
}

.unity-loading-overlay,
.unity-mobile-blocker {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.unity-loading-overlay {
  z-index: 20;
  overflow: hidden;
  background: transparent;
  transition: visibility 0s 1350ms;
}

/* 加载背景独立成层：加载期间覆盖 canvas。
   过渡时它保持不透明垫在幕布下方（幕布淡入期间 canvas 不露底），
   幕布 250ms 完全成形后它瞬间隐藏（在不透明幕布后面，消失不可见），
   这样幕布 300ms 开始滑开时，露出的直接就是 canvas */
.unity-loading-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.985) 0%, rgba(250, 251, 252, 0.98) 100%);
  transition: opacity 0s 250ms;
}

.unity-loading-overlay.is-hidden .unity-loading-bg {
  opacity: 0;
}

/* —— 对角撕开过渡：两片幕布沿对角线滑出 —— */
.unity-loading-overlay::before,
.unity-loading-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* 加载期间透明隐藏，不遮挡原有 loading 背景；过渡开始时浮现 */
  opacity: 0;
  will-change: transform, opacity;
}

.unity-loading-overlay::before {
  z-index: 2;
  /* 上幕：向对角线另一侧延伸 2%（覆盖 x+y ≤ 102% 区域） */
  clip-path: polygon(0 0, 102% 0, 0 102%);
  background:
    radial-gradient(circle at 16% 14%, rgba(214, 235, 255, 0.9), transparent 46%),
    linear-gradient(135deg, #ffffff 0%, #f5fafd 100%);
  /* 幕布在背景层之上淡入 250ms（背景层保持不透明垫底，canvas 不露底），
     滑出延迟 300ms，等幕布成形后再拉开 */
  transition:
    transform 1000ms cubic-bezier(0.22, 1, 0.36, 1) 300ms,
    opacity 250ms ease-out;
}

.unity-loading-overlay::after {
  z-index: 3;
  /* 下幕：向对方延伸 2%（覆盖 x+y ≥ 98% 区域），与上幕在 98%~102% 之间重叠，
     重叠带内下方永远是另一片幕布的实体像素，消除抗锯齿接缝黑线 */
  clip-path: polygon(98% 0, 100% 0, 100% 100%, 0 100%, 0 98%);
  background:
    radial-gradient(circle at 84% 86%, rgba(216, 241, 241, 0.85), transparent 48%),
    linear-gradient(135deg, #ffffff 0%, #eef7fb 100%);
  transition:
    transform 1000ms cubic-bezier(0.22, 1, 0.36, 1) 300ms,
    opacity 250ms ease-out;
}

.unity-loading-overlay.is-hidden::before,
.unity-loading-overlay.is-hidden::after {
  opacity: 1;
}

.unity-loading-overlay.is-hidden::before {
  transform: translate(-115%, -115%) rotate(-4deg) skewX(-6deg);
}

.unity-loading-overlay.is-hidden::after {
  transform: translate(115%, 115%) rotate(4deg) skewX(-6deg);
}

.unity-loading-pattern {
  position: absolute;
  z-index: 4;
  inset: -3%;
  opacity: 0.74;
  transition: opacity 320ms cubic-bezier(0.4, 0, 1, 1);
  background-image:
    linear-gradient(30deg, rgba(172, 180, 186, 0.08) 1px, transparent 1px),
    linear-gradient(150deg, rgba(172, 180, 186, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 18% 35%, transparent 0 62px, rgba(154, 164, 171, 0.13) 63px 64px, transparent 65px),
    radial-gradient(circle at 82% 67%, transparent 0 92px, rgba(154, 164, 171, 0.11) 93px 94px, transparent 95px),
    radial-gradient(circle at 28% 72%, rgba(176, 184, 190, 0.14) 0 4px, transparent 5px),
    radial-gradient(circle at 74% 26%, rgba(176, 184, 190, 0.12) 0 3px, transparent 4px),
    conic-gradient(from 90deg at 72% 34%, rgba(180, 188, 194, 0.09) 0deg 58deg, transparent 58deg 360deg);
  background-size: 64px 36px, 64px 36px, auto, auto, auto, auto, auto;
  mask-image: linear-gradient(180deg, transparent, black 12%, black 88%, transparent);
  pointer-events: none;
  animation: patternDrift 28s ease-in-out infinite;
}

.unity-loading-pattern::before,
.unity-loading-pattern::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(150, 164, 173, 0.18);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(167, 178, 185, 0.05);
  animation: orbitDrift 18s linear infinite;
}

.unity-loading-pattern::before {
  width: 180px;
  height: 180px;
  top: 9%;
  right: 12%;
}

.unity-loading-pattern::after {
  width: 300px;
  height: 300px;
  bottom: -120px;
  left: 18%;
  animation-direction: reverse;
  animation-duration: 24s;
}

.unity-loading-overlay.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.unity-loading-overlay.is-hidden .unity-loading-panel {
  opacity: 0;
  transform: translateY(-16px) scale(0.985);
}

.unity-loading-overlay.is-hidden .unity-loading-aurora,
.unity-loading-overlay.is-hidden .unity-loading-pattern {
  opacity: 0;
}

.unity-loading-aurora {
  position: absolute;
  z-index: 4;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.6;
  animation: auroraFloat 9s ease-in-out infinite;
  transition: opacity 320ms cubic-bezier(0.4, 0, 1, 1);
}

.unity-loading-aurora-primary {
  width: 320px;
  height: 320px;
  top: 8%;
  left: 8%;
  background: radial-gradient(circle, rgba(202, 216, 224, 0.36) 0%, rgba(202, 216, 224, 0) 72%);
}

.unity-loading-aurora-secondary {
  width: 360px;
  height: 360px;
  right: 4%;
  bottom: 12%;
  background: radial-gradient(circle, rgba(211, 224, 229, 0.32) 0%, rgba(211, 224, 229, 0) 74%);
  animation-duration: 11s;
  animation-delay: -2.5s;
}

.unity-loading-aurora-accent {
  width: 240px;
  height: 240px;
  right: 18%;
  top: 14%;
  background: radial-gradient(circle, rgba(218, 218, 229, 0.3) 0%, rgba(218, 218, 229, 0) 72%);
  animation-duration: 8.4s;
  animation-delay: -4.2s;
}

.unity-loading-panel,
.unity-mobile-card {
  position: relative;
  width: min(460px, calc(100vw - 48px));
  padding: 30px 30px 28px;
  border: 1px solid var(--shell-border);
  border-radius: 30px;
  background: var(--glass-panel);
  box-shadow: var(--shell-shadow);
  backdrop-filter: blur(24px);
}

.unity-loading-panel {
  z-index: 5;
  width: min(560px, calc(100vw - 48px));
  padding: 30px 30px 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  text-align: center;
  transition: opacity 320ms cubic-bezier(0.4, 0, 1, 1), transform 320ms cubic-bezier(0.4, 0, 1, 1);
}

.unity-loading-title,
.unity-mobile-title {
  color: var(--shell-text);
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

.unity-loading-status,
.unity-mobile-message {
  margin-top: 12px;
  color: var(--shell-text-soft);
  font-size: 15px;
  line-height: 1.7;
}

.unity-loading-orbs {
  margin: 30px auto 24px;
}

.loader {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  height: 80px;
  padding: 0 6px;
  position: relative;
}

.ball {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  outline: 1px solid rgba(0, 0, 0, 0.05);
  outline-offset: -1px;
  animation:
    bounceWave 1.6s ease-in-out infinite,
    colorShift 1.6s ease-in-out infinite;
  background: var(--base-color);
  will-change: transform, filter;
}

.ball:nth-child(1) {
  --base-color: #6ab7ff;
  animation-delay: 0s, 0s;
}

.ball:nth-child(2) {
  --base-color: #7dd6d1;
  animation-delay: 0.2s, 0.2s;
}

.ball:nth-child(3) {
  --base-color: #9fa8ff;
  animation-delay: 0.4s, 0.4s;
}

.unity-progress-shell {
  position: relative;
  width: 100%;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -10px 24px rgba(162, 191, 232, 0.14);
}

.unity-progress-fill {
  position: relative;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--progress-fill-start) 0%, var(--progress-fill-mid) 54%, var(--progress-fill-end) 100%);
  box-shadow: 0 8px 20px rgba(112, 175, 255, 0.3);
  transition: width 160ms linear;
}

.unity-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.42) 50%, transparent 100%);
  animation: progressSheen 1.9s linear infinite;
}

.unity-loading-percent {
  margin-top: 12px;
  color: #5f8fc8;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.unity-mobile-blocker {
  z-index: 25;
  background: var(--glass-overlay);
  backdrop-filter: blur(22px);
}

.unity-mobile-card {
  text-align: center;
}

.unity-mobile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7cc6ff 0%, #9cb7ff 100%);
  color: white;
  font-size: 30px;
  font-weight: 700;
  box-shadow: 0 16px 34px rgba(104, 170, 255, 0.3);
}

.unity-toolbar {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 999px;
  background: var(--toolbar-bg);
  box-shadow: 0 20px 44px rgba(6, 12, 22, 0.26);
  backdrop-filter: blur(20px);
  transform: translateX(-50%);
  transition: opacity 180ms ease, transform 180ms ease;
}

.unity-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.unity-toolbar.is-collapsed .unity-toolbar-controls {
  display: none;
}

.unity-toolbar.is-collapsed {
  padding: 8px;
}

.unity-toolbar.is-collapsed .unity-toolbar-toggle {
  transform: rotate(180deg);
}

.unity-toolbar-toggle {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
}

.unity-toolbar-extras {
  display: flex;
  align-items: center;
  gap: 10px;
}

.unity-tool-button,
.unity-toolbar-extras button,
.unity-profiler-button {
  appearance: none;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(245, 249, 255, 0.95);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.unity-tool-button:hover,
.unity-toolbar-extras button:hover,
.unity-profiler-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
}

.unity-tool-button:focus-visible,
.unity-toolbar-extras button:focus-visible,
.unity-profiler-button:focus-visible {
  outline: 2px solid rgba(161, 216, 255, 0.9);
  outline-offset: 2px;
}

.swal2-popup.unity-shell-popup {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 28px 70px rgba(86, 133, 191, 0.2);
  backdrop-filter: blur(24px);
}

.swal2-popup.unity-shell-popup .swal2-title {
  color: var(--shell-text);
}

.swal2-popup.unity-shell-popup .swal2-html-container {
  color: var(--shell-text-soft);
}

.swal2-popup.unity-shell-popup .swal2-confirm {
  border-radius: 999px;
  background: linear-gradient(135deg, #78bfff 0%, #9bb4ff 100%);
  box-shadow: 0 12px 24px rgba(105, 172, 255, 0.24);
}

.swal2-popup.unity-shell-popup .swal2-styled:focus {
  box-shadow: 0 0 0 3px rgba(123, 191, 255, 0.28);
}

[hidden] {
  display: none !important;
}

@keyframes auroraFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(18px, -24px, 0) scale(1.08);
  }
}

@keyframes patternDrift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(-10px, 8px, 0) scale(1.02);
  }
}

@keyframes orbitDrift {
  from {
    transform: rotate(0deg) translateX(8px) rotate(0deg);
  }

  to {
    transform: rotate(360deg) translateX(8px) rotate(-360deg);
  }
}

@keyframes progressSheen {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(120%);
  }
}

@keyframes bounceWave {
  0%,
  12% {
    transform: translateY(0px) scale(1, 1);
  }

  20% {
    transform: translateY(-8px) scale(0.94, 1.08);
  }

  30% {
    transform: translateY(-22px) scale(0.96, 1.06);
  }

  42% {
    transform: translateY(-36px) scale(1.05, 1.05);
  }

  54% {
    transform: translateY(-26px) scale(0.97, 1.04);
  }

  64% {
    transform: translateY(-6px) scale(0.95, 1.07);
  }

  70% {
    transform: translateY(2px) scale(1.08, 0.9);
  }

  76% {
    transform: translateY(-10px) scale(0.93, 1.09);
  }

  82% {
    transform: translateY(-3px) scale(0.99, 1.03);
  }

  88% {
    transform: translateY(-1px) scale(1.01, 0.99);
  }

  93% {
    transform: translateY(0px) scale(1.04, 0.96);
  }

  96% {
    transform: translateY(0px) scale(1.02, 0.98);
  }

  98%,
  100% {
    transform: translateY(0px) scale(1, 1);
  }
}

@keyframes colorShift {
  0%,
  12%,
  98%,
  100% {
    filter: brightness(1) saturate(1);
  }

  42% {
    filter: brightness(1.12) saturate(0.88);
  }
}

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

@media (max-width: 640px) {
  .unity-loading-panel,
  .unity-mobile-card {
    width: calc(100vw - 32px);
    padding: 26px 22px 24px;
    border-radius: 24px;
  }

  .unity-loading-title,
  .unity-mobile-title {
    font-size: 28px;
  }

  .loader {
    gap: 14px;
  }

  .ball {
    width: 20px;
    height: 20px;
  }
}
