/* ═══════════════════════════════════════════════════════
   Khối TNT ở góc dưới-trái (easter egg).
   Ảnh khối: assets/img/mc/tnt/block.png (render 3D của khối TNT).
   Tro, khói, mảnh vụn: texture particle gốc lấy từ client jar
   (explosion_0..15, big_smoke_0..11, tnt_side) — xem tnt-egg.js.
   Toàn bộ selector nằm trong .tnt-egg / .tnt-fx / .tnt-scorch /
   .scare để không đụng phần còn lại của site.
═══════════════════════════════════════════════════════ */

/* Khối nằm trong footer, cuối trang: chừa một dải trống dưới cùng để
   khối không đè lên dòng bản quyền. */
.tnt-spot {
  padding-bottom: 112px;
}
.tnt-egg {
  position: absolute;
  left: 20px;
  bottom: 16px;
  width: 76px;
  height: 85px;
  z-index: 9990;
  padding: 0;
  border: 0;
  background: none;
  cursor: url("/assets/img/mc/tnt/cursor.png") 7 7, pointer;
  transform-origin: 50% 100%;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.tnt-egg img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  animation: tnt-bob 4.2s ease-in-out infinite;
}
/* Bóng đổ dưới khối, nhấp nhô ngược pha với khối cho có cảm giác lơ lửng. */
.tnt-egg::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -1px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(0, 0, 0, 0.62) 0%,
    rgba(0, 0, 0, 0.25) 52%,
    rgba(0, 0, 0, 0) 78%
  );
  animation: tnt-bob-shadow 4.2s ease-in-out infinite;
  pointer-events: none;
}
.tnt-egg:hover {
  transform: translateY(-2px);
}
@keyframes tnt-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
@keyframes tnt-bob-shadow {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.72;
    transform: scale(0.9);
  }
}

/* Lớp trắng nhấp nháy khi ngòi đã cháy: tô trắng đúng hình dạng khối
   bằng mask, thay vì filter làm cả ảnh bợt màu. */
.tnt-egg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  -webkit-mask: url("/assets/img/mc/tnt/block.png") center / contain no-repeat;
  mask: url("/assets/img/mc/tnt/block.png") center / contain no-repeat;
  filter: drop-shadow(0 0 12px rgba(255, 238, 196, 0.85));
  opacity: 0;
  pointer-events: none;
}

.tnt-egg.is-primed {
  animation: tnt-swell 2.4s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}
.tnt-egg.is-primed img,
.tnt-egg.is-primed::before {
  animation: none;
}
.tnt-egg.is-primed::after {
  animation: tnt-white 0.26s steps(1, end) infinite;
}
/* Ngòi đang cháy: khối trôi từ footer ra giữa khung nhìn. Chỉ chuyển
   left/top — transform phải nhường cho animation tnt-swell, và khi nổ thì
   .is-gone vẫn thắng để khối thu nhỏ biến mất. Bóng dưới chân mờ dần vì khối
   đã rời mặt đất. */
.tnt-egg.is-flying {
  pointer-events: none;
  transition:
    left var(--tnt-flight, 1940ms) cubic-bezier(0.33, 0.02, 0.25, 1) 160ms,
    top var(--tnt-flight, 1940ms) cubic-bezier(0.33, 0.02, 0.25, 1) 160ms,
    transform 0.2s cubic-bezier(0.2, 0.8, 0.3, 1),
    opacity 0.25s ease;
}
.tnt-egg.is-flying::before {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.tnt-egg.is-gone {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.55);
  transition: transform 0.18s ease-in, opacity 0.18s ease-in;
}

@keyframes tnt-swell {
  0% {
    transform: scale(1);
  }
  22% {
    transform: scale(1.035);
  }
  46% {
    transform: scale(1.015);
  }
  70% {
    transform: scale(1.07);
  }
  100% {
    transform: scale(1.13);
  }
}
@keyframes tnt-white {
  0%,
  52% {
    opacity: 1;
  }
  53%,
  100% {
    opacity: 0;
  }
}

/* Vết cháy còn lại ở góc sau vụ nổ. */
.tnt-scorch {
  position: absolute;
  left: 6px;
  bottom: 0;
  width: 112px;
  height: 78px;
  z-index: 9989;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    ellipse at 50% 72%,
    rgba(0, 0, 0, 0.34) 0%,
    rgba(10, 6, 4, 0.2) 38%,
    rgba(0, 0, 0, 0) 72%
  );
  transition: opacity 0.6s ease;
}
.tnt-scorch.is-on {
  opacity: 1;
}

/* Canvas hiệu ứng nổ phủ toàn màn hình. */
.tnt-fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 9996;
  pointer-events: none;
}

/* ── Lớp "video kinh dị" sau vụ nổ ───────────────────── */
.scare {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: grid;
  place-items: center;
  background: radial-gradient(
    120% 120% at 50% 42%,
    rgba(10, 3, 3, 0.97) 0%,
    rgba(0, 0, 0, 0.99) 62%,
    #000 100%
  );
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s;
}
.scare.is-in {
  opacity: 1;
  visibility: visible;
}
.scare-stage {
  position: relative;
  /* Clip 9:16 nên phải chặn cả bề ngang lẫn bề cao, không thì đầu
     nhân vật thò ra ngoài màn hình. */
  width: min(86vmin, 960px, 56vh);
  transform-origin: 10% 96%;
  transform: scale(0.24);
  opacity: 0;
  transition: transform 0.33s cubic-bezier(0.16, 1.05, 0.28, 1), opacity 0.2s ease;
}
.scare.is-stage .scare-stage {
  transform: scale(1);
  opacity: 1;
}
/* Video có nền tối ở vai và hai bên nên mép khung lộ thành hình chữ nhật;
   mask làm mờ dần bốn góc cho nhân vật hoà vào nền đen. */
.scare-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  -webkit-mask-image: radial-gradient(ellipse 84% 76% at 50% 44%, #000 56%, rgba(0, 0, 0, 0) 100%);
  mask-image: radial-gradient(ellipse 84% 76% at 50% 44%, #000 56%, rgba(0, 0, 0, 0) 100%);
}
.scare-video {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}
.scare-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.82);
  font: 400 18px/1 system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.scare-close:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
}
.scare-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  margin: 0;
  text-align: center;
  font: 500 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 640px) {
  .tnt-spot {
    padding-bottom: 92px;
  }
  .tnt-egg {
    left: 12px;
    bottom: 12px;
    width: 58px;
    height: 65px;
  }
  .tnt-scorch {
    left: 2px;
    bottom: 0;
    width: 88px;
    height: 62px;
  }
  .scare-stage {
    width: min(95vw, 48vh);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tnt-egg,
  .scare,
  .scare-stage,
  .scare-close {
    transition-duration: 0.01ms;
  }
  .tnt-egg img,
  .tnt-egg::before {
    animation: none;
  }
  .tnt-egg.is-primed {
    animation: none;
  }
  .scare-stage,
  .scare.is-stage .scare-stage {
    transform: none;
    opacity: 1;
  }
}
