* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: #061b1d;
  font-family: "HarmonyOS Sans SC", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.viewport {
  position: relative;
  display: grid;
  width: 100vw;
  height: 100vh;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background: #061b1d;
}

.viewport::before {
  position: absolute;
  inset: -2%;
  z-index: 0;
  content: "";
  background-image:
    linear-gradient(rgba(6, 27, 29, 0.18), rgba(6, 27, 29, 0.18)),
    url("../assets/trials/主背景图.png");
  background-position: center;
  background-size: cover;
  filter: blur(9px) brightness(0.72) saturate(1.08);
  transform: scale(1.04);
}

.stage {
  position: relative;
  z-index: 1;
  width: min(100vw, 150vh);
  aspect-ratio: 1536 / 1024;
  overflow: hidden;
  isolation: isolate;
  background: #08291f;
  box-shadow: 0 0 72px rgba(0, 0, 0, 0.74);
}

.forest-bg,
.stage img {
  user-select: none;
  -webkit-user-drag: none;
}

.forest-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage::before,
.stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  pointer-events: none;
}

.stage::before {
  background:
    linear-gradient(180deg, rgba(3, 18, 26, 0.06), rgba(2, 15, 18, 0.16)),
    radial-gradient(circle at 50% 48%, rgba(255, 225, 122, 0.05), transparent 43%),
    radial-gradient(circle at 50% 65%, transparent 55%, rgba(0, 8, 8, 0.22) 100%);
}

.stage::after {
  opacity: 0.56;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 237, 161, 0.7) 0 0.08%, transparent 0.28%),
    radial-gradient(circle at 38% 18%, rgba(255, 255, 255, 0.64) 0 0.07%, transparent 0.26%),
    radial-gradient(circle at 72% 15%, rgba(255, 228, 143, 0.72) 0 0.08%, transparent 0.28%),
    radial-gradient(circle at 88% 46%, rgba(255, 255, 255, 0.52) 0 0.06%, transparent 0.22%);
  animation: twinkle 3.8s ease-in-out infinite alternate;
}

.back-button,
.forest-title,
.trial-grid {
  position: absolute;
  z-index: 5;
}

.back-button {
  top: 1.25%;
  left: 1.15%;
  display: block;
  width: 6.55%;
  aspect-ratio: 1;
  transform-origin: center;
}

.back-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 0.7vmin 0.42vmin rgba(0, 0, 0, 0.58))
    drop-shadow(0 0 0.65vmin rgba(255, 215, 104, 0.36));
  transform-origin: center;
  animation: breathe-float 2.05s ease-in-out infinite;
}

.forest-title {
  top: -1.2%;
  left: 50%;
  width: 43.2%;
  height: auto;
  filter:
    drop-shadow(0 0.8vmin 0.5vmin rgba(0, 0, 0, 0.52))
    drop-shadow(0 0 0.8vmin rgba(255, 222, 124, 0.28));
  transform: translateX(-50%);
}

.trial-grid {
  inset: 14.15% 3.25% 3.2%;
}

.trial-card {
  position: absolute;
  display: block;
  width: 19.25%;
  aspect-ratio: 500 / 768;
  border-radius: 1.4vmin;
  outline: none;
  transform-origin: center bottom;
  animation: card-arrive 540ms ease-out both;
  transition:
    transform 180ms ease,
    filter 180ms ease;
}

.trial-card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 0.95vmin 0.55vmin rgba(0, 0, 0, 0.4))
    drop-shadow(0 0 0.45vmin rgba(255, 214, 112, 0.16));
  transform-origin: center bottom;
  animation: breathe-float 2.45s ease-in-out infinite;
}

.trial-card:hover,
.trial-card:focus-visible {
  filter: brightness(1.08) saturate(1.04);
}

.trial-card::before {
  position: absolute;
  top: 7%;
  right: 7%;
  z-index: 2;
  min-width: 4.2em;
  padding: 0.42em 0.65em;
  border: 0.18vmin solid rgba(255, 247, 190, 0.86);
  border-radius: 999px;
  color: #fff7c2;
  content: attr(data-status-label);
  font-size: clamp(12px, 1.35vmin, 16px);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0.16vmin 0.2vmin rgba(55, 34, 8, 0.74);
  pointer-events: none;
  opacity: 0;
  background: rgba(70, 45, 18, 0.82);
  box-shadow: 0 0.38vmin 0.7vmin rgba(0, 0, 0, 0.32);
}

.trial-card.is-completed::before,
.trial-card.is-started::before {
  opacity: 1;
}

.trial-card .completion-mark {
  position: absolute;
  right: 7.5%;
  bottom: 6%;
  z-index: 2;
  display: grid;
  width: 13.5%;
  aspect-ratio: 1;
  border: 0.25vmin solid rgba(255, 248, 197, 0.92);
  border-radius: 50%;
  color: #fff9c8;
  font-size: clamp(16px, 2.6vmin, 30px);
  font-weight: 900;
  line-height: 1;
  place-items: center;
  pointer-events: none;
  background: linear-gradient(180deg, #46b868, #17733b);
  box-shadow:
    0 0.45vmin 0.8vmin rgba(0, 0, 0, 0.35),
    0 0 0.9vmin rgba(255, 236, 132, 0.48);
}

.trial-card.is-started::before {
  color: #fff5c8;
  background: rgba(30, 104, 91, 0.9);
}

.trial-card:focus-visible::after {
  position: absolute;
  inset: 7.5% 5% 3.5%;
  border: 0.22vmin solid rgba(255, 238, 158, 0.95);
  border-radius: 1.2vmin;
  content: "";
  pointer-events: none;
  box-shadow: 0 0 1vmin rgba(255, 218, 95, 0.7);
}

.card-1 {
  left: 0;
  top: 0;
  animation-delay: 0ms;
}

.card-2 {
  left: 20.18%;
  top: 0;
  animation-delay: 45ms;
}

.card-3 {
  left: 40.36%;
  top: 0;
  animation-delay: 90ms;
}

.card-4 {
  left: 60.54%;
  top: 0;
  animation-delay: 135ms;
}

.card-5 {
  right: 0;
  top: 0;
  animation-delay: 180ms;
}

.card-6 {
  left: 0;
  bottom: -0.1%;
  animation-delay: 225ms;
}

.card-7 {
  left: 20.18%;
  bottom: -0.1%;
  animation-delay: 270ms;
}

.card-8 {
  left: 40.36%;
  bottom: -0.1%;
  animation-delay: 315ms;
}

.card-9 {
  left: 60.54%;
  bottom: -0.1%;
  animation-delay: 360ms;
}

.card-10 {
  right: 0;
  bottom: -0.1%;
  animation-delay: 405ms;
}

.card-1 img {
  animation-delay: 560ms;
}

.card-2 img {
  animation-delay: 620ms;
}

.card-3 img {
  animation-delay: 680ms;
}

.card-4 img {
  animation-delay: 740ms;
}

.card-5 img {
  animation-delay: 800ms;
}

.card-6 img {
  animation-delay: 860ms;
}

.card-7 img {
  animation-delay: 920ms;
}

.card-8 img {
  animation-delay: 980ms;
}

.card-9 img {
  animation-delay: 1040ms;
}

.card-10 img {
  animation-delay: 1100ms;
}

@keyframes card-arrive {
  from {
    opacity: 0;
    transform: translateY(4%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes breathe-float {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-1.45%) scale(1.025);
  }
}

@keyframes twinkle {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 0.76;
  }
}

@media (max-aspect-ratio: 1536 / 1024) {
  .stage {
    width: auto;
    height: 100vh;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .stage {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
  }

  .forest-bg {
    width: 150vh;
    max-width: none;
    transform: translateX(-28%);
  }

  .back-button {
    width: 15%;
  }

  .forest-title {
    top: 1.2%;
    left: 56%;
    width: 78%;
  }

  .trial-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5% 0;
    inset: 14.5% 3.5% 2.5%;
    overflow-y: auto;
    padding: 0 0 5%;
  }

  .trial-card {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 500 / 790;
  }

  .trial-card img {
    height: 100%;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .stage {
    width: 100vw;
    height: auto;
  }
}

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

