/* =========================================================
   visuals.css — 可复用的「作品视觉」小组件
   手机框 / 史莱姆网格 / 木牌 / 物品 / 声波 / 快捷栏 / 锁
   ========================================================= */

/* ---------- generic pixel art ---------- */
.pixel {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* ---------- phone frame ---------- */
.device {
  position: relative;
  width: var(--device-w, 280px);
  aspect-ratio: 430 / 920;
  border-radius: 38px;
  padding: 9px;
  background: linear-gradient(155deg, #2b2620, #17130f 42%, #0c0a08);
  border: 1px solid rgba(255, 246, 230, 0.16);
  box-shadow: 0 50px 110px -40px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 80px -20px rgba(242, 163, 60, 0.18);
  transform: rotate(var(--device-rot, -4deg));
  transition: transform 0.9s var(--ease);
}
.device::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
  z-index: 2;
}
.device::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 38px;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.14),
    transparent 32%,
    transparent 70%,
    rgba(255, 255, 255, 0.05)
  );
  pointer-events: none;
  z-index: 3;
}
.device__screen {
  width: 100%;
  height: 100%;
  border-radius: 30px;
  overflow: hidden;
  background: #0d0c0a;
  position: relative;
}
.device__screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.device__notch {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 74px;
  height: 18px;
  border-radius: 999px;
  background: #050403;
  z-index: 4;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.06);
}

/* ---------- floating print / screenshot ---------- */
.print {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 246, 230, 0.16);
  background: #0d0c0a;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
}
.print img {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- slime chunk grid ---------- */
.slime-grid {
  display: grid;
  grid-template-columns: repeat(var(--slime, 12), 1fr);
  gap: 1px;
  width: 100%;
  aspect-ratio: 1;
  padding: 4px;
  background: #0b130d;
  border-radius: 8px;
  border: 1px solid rgba(99, 210, 154, 0.16);
}
.slime-grid i {
  display: block;
  border-radius: 1px;
  background: rgba(99, 210, 154, 0.06);
}
.slime-grid i.is-slime {
  background: #4fd88c;
  box-shadow: 0 0 6px rgba(79, 216, 140, 0.7);
}
.slime-grid i.is-center {
  background: #ffd479;
  box-shadow: 0 0 8px rgba(255, 212, 121, 0.8);
}

/* ---------- sign ---------- */
.sign {
  position: relative;
  aspect-ratio: 2 / 1;
  border-radius: 4px;
  padding: 10% 8%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4%;
  background: repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.16) 0 2px,
      transparent 2px 33%
    ),
    linear-gradient(180deg, #a9713c, #85552b 55%, #6d4421);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35),
    inset 0 0 24px rgba(0, 0, 0, 0.4), 0 10px 24px -12px rgba(0, 0, 0, 0.8);
  image-rendering: pixelated;
}
.sign::before,
.sign::after {
  content: "";
  position: absolute;
  top: -9%;
  bottom: -9%;
  width: 4%;
  background: linear-gradient(180deg, #7a4f27, #5c3a1b);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.sign::before {
  left: 5%;
}
.sign::after {
  right: 5%;
}
.sign span {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(7px, 1.15vw, 11px);
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: #2b1a0b;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}
.sign span:nth-child(1) {
  color: #1d5c2c;
}
.sign span:nth-child(4) {
  color: #3b2a8a;
}

/* ---------- emerald gem ---------- */
.gem {
  width: 26px;
  height: 26px;
  flex: none;
  background: linear-gradient(135deg, #9af5b8, #37c168 45%, #0f7a3a);
  clip-path: polygon(50% 0, 90% 22%, 100% 62%, 50% 100%, 0 62%, 10% 22%);
  filter: drop-shadow(0 3px 8px rgba(55, 193, 104, 0.45));
}

/* ---------- hotbar ---------- */
.hotbar {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: rgba(13, 12, 10, 0.88);
  border: 1px solid rgba(255, 246, 230, 0.22);
  border-radius: 4px;
  box-shadow: 0 12px 30px -14px #000, inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.hotbar__slot {
  position: relative;
  width: clamp(20px, 3.4vw, 34px);
  aspect-ratio: 1;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  display: grid;
  place-items: center;
}
.hotbar__slot img {
  width: 74%;
  height: 74%;
  object-fit: contain;
  image-rendering: pixelated;
}
.hotbar__slot--active {
  border-color: #f6f1e6;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55), 0 0 14px rgba(255, 255, 255, 0.35);
}
.hotbar__count {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-family: var(--font-mono);
  font-size: clamp(6px, 0.9vw, 9px);
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
  pointer-events: none;
}

/* ---------- voice waveform ---------- */
.wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 0.45vw, 5px);
  height: 100%;
}
.wave i {
  display: block;
  width: clamp(2px, 0.34vw, 4px);
  border-radius: 99px;
  background: linear-gradient(180deg, #d8ccff, #8f7cf0);
  height: calc(var(--h, 30) * 1%);
  opacity: 0.85;
  animation: wave 1.6s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * -0.06s);
  transform-origin: center;
}
@keyframes wave {
  0% {
    transform: scaleY(0.32);
    opacity: 0.4;
  }
  100% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* ---------- auth lock & flow ---------- */
.lock {
  width: clamp(46px, 5vw, 64px);
  height: clamp(46px, 5vw, 64px);
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px solid rgba(111, 198, 242, 0.28);
  background: radial-gradient(
    circle at 50% 30%,
    rgba(111, 198, 242, 0.16),
    rgba(111, 198, 242, 0.02) 70%
  );
  color: #9fdcfb;
  box-shadow: 0 0 40px -10px rgba(111, 198, 242, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.lock svg {
  width: 55%;
  height: 55%;
}
.auth-flow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(8px, 1.6vw, 18px);
  width: 100%;
}
.auth-node {
  font-family: var(--font-mono);
  font-size: clamp(7px, 1vw, 9px);
  letter-spacing: 0.16em;
  color: #8fdcff;
  padding: 5px 8px;
  border: 1px solid rgba(111, 198, 242, 0.24);
  border-radius: 6px;
  background: rgba(111, 198, 242, 0.06);
  white-space: nowrap;
}
.auth-lines {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.8vw, 8px);
  position: relative;
}
.auth-line {
  position: relative;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(111, 198, 242, 0.05),
    rgba(111, 198, 242, 0.55),
    rgba(111, 198, 242, 0.05)
  );
}
.auth-line::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a9e4ff;
  box-shadow: 0 0 10px #6fc6f2;
  transform: translateY(-50%);
  animation: packet 2.6s linear infinite;
  animation-delay: var(--p, 0s);
}
.auth-line--rev::after {
  animation-name: packet-rev;
}
@keyframes packet {
  0% {
    left: 0;
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    left: calc(100% - 5px);
    opacity: 0;
  }
}
@keyframes packet-rev {
  0% {
    left: calc(100% - 5px);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    left: 0;
    opacity: 0;
  }
}
.auth-line__tag {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: clamp(6px, 0.9vw, 8px);
  letter-spacing: 0.14em;
  color: rgba(143, 220, 255, 0.72);
  background: #0d0c0a;
  padding: 0 4px;
  white-space: nowrap;
}

/* ---------- generic caption inside visual ---------- */
.visual-cap {
  font-family: var(--font-mono);
  font-size: clamp(7px, 0.95vw, 10px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 246, 230, 0.5);
}

/* ---------- shared screenshot gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(12px, 1.6vw, 20px);
}
.gallery__item {
  position: relative;
  grid-column: span 4;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: zoom-in;
  transition: border-color 0.45s var(--ease), transform 0.6s var(--ease);
}
.gallery__item:hover {
  border-color: rgba(242, 163, 60, 0.4);
  transform: translateY(-3px);
}
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 1.1s var(--ease);
}
.gallery__item:hover img {
  transform: scale(1.03);
}
.gallery__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.55));
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.gallery__item:hover::after {
  opacity: 1;
}
.gallery__cap {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  z-index: 2;
  font-size: 12px;
  color: rgba(255, 246, 230, 0.9);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  text-shadow: 0 1px 8px #000;
}
.gallery__item:hover .gallery__cap {
  opacity: 1;
  transform: none;
}
.gallery__item--wide {
  grid-column: span 6;
}
.gallery__item--tall {
  grid-column: span 4;
}
.gallery__item--tall img {
  aspect-ratio: 520 / 1000;
  object-fit: cover;
  object-position: top;
}
.gallery__item--phone img {
  aspect-ratio: 430 / 920;
  object-fit: cover;
  object-position: top;
}
.gallery__item--desk img {
  aspect-ratio: 1280 / 950;
  object-fit: cover;
  object-position: top;
}
.gallery__item--fill img {
  aspect-ratio: 4 / 3;
}
@media (max-width: 860px) {
  .gallery__item,
  .gallery__item--wide,
  .gallery__item--tall {
    grid-column: span 6;
  }
}
@media (max-width: 560px) {
  .gallery__item,
  .gallery__item--wide,
  .gallery__item--tall {
    grid-column: span 6;
  }
  .gallery__item--wide {
    grid-column: span 12;
  }
  .gallery__item img {
    aspect-ratio: 3 / 4;
    object-fit: cover;
    object-position: top;
  }
  .gallery__item--desk img {
    aspect-ratio: 4 / 3;
  }
  .gallery__cap {
    opacity: 1;
    transform: none;
    font-size: 10px;
  }
}

/* ---------- pixel icons ---------- */
.px-icon {
  image-rendering: pixelated;
  width: 24px;
  height: 24px;
  object-fit: contain;
}
