/* d:\Game\css\tactile-vfx.css */

/* 1. Quầng sáng Đèn bàn ấm */
.desk-lamp-glow {
  background: radial-gradient(
    circle at center,
    rgba(255, 214, 130, 0.42) 0%,
    rgba(255, 184, 77, 0.16) 48%,
    rgba(0, 0, 0, 0) 72%
  );
  mix-blend-mode: screen;
  pointer-events: none;
}

/* 2. Nắp phong bì cong lên theo tiến độ hơ hơi nước (--steam-progress: 0 -> 1) */
.envelope-wrapper {
  perspective: 600px;
}

.envelope-flap {
  transform-origin: top center;
  transform: rotateX(calc(var(--steam-progress, 0) * 22deg));
  filter: drop-shadow(0 calc(var(--steam-progress, 0) * 8px) 6px rgba(0, 0, 0, 0.35));
  transition: transform 0.08s linear;
}

/* Làn hơi nước mờ bay lên */
@keyframes steamRise {
  0% { transform: translateY(0) scale(0.8); opacity: 0; }
  35% { opacity: 0.45; }
  100% { transform: translateY(-48px) scale(1.6); opacity: 0; }
}

.steam-wisp {
  animation: steamRise 1.1s ease-out infinite;
  pointer-events: none;
}

/* 3. Đóng dấu mộc & Rung mặt bàn 1–2px trong 120ms */
@keyframes stampSlam {
  0% { transform: scale(1.55) rotate(-6deg); opacity: 0.2; }
  70% { transform: scale(0.96) rotate(-6deg); opacity: 0.92; }
  100% { transform: scale(1) rotate(-6deg); opacity: 0.88; }
}

.stamp-mark {
  animation: stampSlam 0.14s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
  mix-blend-mode: multiply;
}

@keyframes deskShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, -2px); }
}

.desk-shake-active {
  animation: deskShake 0.12s linear;
}

/* 4. Pinboard: Nét bút đỏ gạch ngang khi bị invalidatedByFlag vô hiệu hóa */
.clue-card.invalidated {
  opacity: 0.72;
  filter: grayscale(0.45);
  position: relative;
}

.clue-card.invalidated::after {
  content: "";
  position: absolute;
  left: 6%;
  top: 50%;
  height: 3px;
  background: #b91c1c;
  animation: strikeRed 0.45s ease-out forwards;
  pointer-events: none;
}

@keyframes strikeRed {
  from { width: 0%; }
  to { width: 88%; }
}

/* Cụm Bộ 3 giải mã thành công */
.clue-card.triad-solved {
  border-color: #10b981;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.38);
}

/* =========================================================
   5. GAME FEEL — QUẦNG SÁNG X-RAY THEO CHUỘT & KÉO THẢ
   ========================================================= */

/* Quầng sáng đèn bàn di chuyển theo con trỏ chuột */
.desk-stage.lamp-lit::before {
  background: radial-gradient(
    circle 230px at var(--lamp-x, 50%) var(--lamp-y, 45%),
    rgba(254, 236, 148, 0.38) 0%,
    rgba(255, 200, 96, 0.12) 48%,
    transparent 74%
  ) !important;
  transition: background 0.04s linear;
}

/* Lớp X-ray bên trong phong bì lộ rõ theo tâm đèn chiếu */
.envelope-xray-layer.visible {
  opacity: 0.92;
  -webkit-mask-image: radial-gradient(
    circle 105px at var(--xray-x, 50%) var(--xray-y, 50%),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0.72) 55%,
    rgba(0, 0, 0, 0.14) 100%
  );
  mask-image: radial-gradient(
    circle 105px at var(--xray-x, 50%) var(--xray-y, 50%),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 0.72) 55%,
    rgba(0, 0, 0, 0.14) 100%
  );
}

/* Trạng thái công cụ đang bật / đang hơ hơi nước */
.tool-zone.tool-active {
  border-color: var(--brass-bright);
  box-shadow:
    inset 0 1px 0 rgba(255, 224, 155, 0.35),
    0 0 16px rgba(254, 214, 102, 0.42);
}

.tool-zone.tool-active .tool-icon {
  background: radial-gradient(circle, #fde08d 0%, #b8860b 100%);
  color: #2b1a0c;
  box-shadow: 0 0 12px rgba(254, 224, 130, 0.75);
}

.tool-zone.tool-pulse {
  animation: toolPulse 0.32s ease-out;
}

@keyframes toolPulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.tool-kettle {
  cursor: pointer;
}

.tool-lamp,
.tool-magnifier {
  cursor: pointer;
}

/* Hiệu ứng nhấc phong bì khi kéo */
.mail-card.dragging {
  transform: rotate(1.4deg) scale(0.98) !important;
  opacity: 0.86;
  filter: drop-shadow(14px 22px 24px rgba(0, 0, 0, 0.78)) !important;
}

/* Mời gọi vùng thả khi đang kéo thư */
body.drag-active .town-bin,
body.drag-active .drop-zone {
  border-color: rgba(212, 162, 56, 0.72);
  box-shadow:
    inset 0 8px 16px rgba(0, 0, 0, 0.85),
    0 0 10px rgba(212, 162, 56, 0.25);
}

/* Rung nhẹ phong bì khi đang hơ hơi nước */
.mail-card.steam-holding {
  animation: steamFlutter 0.18s ease-in-out infinite alternate;
}

@keyframes steamFlutter {
  from { transform: rotate(-0.6deg) rotateX(var(--curl-deg, 0deg)) translateY(0px); }
  to { transform: rotate(-0.3deg) rotateX(var(--curl-deg, 0deg)) translateY(-1px); }
}

/* Ảnh kéo nhỏ gọn không che khuất Hộc Thị Trấn */
.mail-drag-ghost {
  position: fixed;
  top: -200px;
  left: -200px;
  background: #f5eedc;
  color: #2b2118;
  border: 2px solid #b8860b;
  border-left: 5px solid #8b261d;
  border-radius: 3px;
  padding: 6px 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.65);
  white-space: nowrap;
  pointer-events: none;
}

/* Làm rõ rệt hộc đang trỏ chuột vào khi kéo thư */
.town-bin.drag-over {
  border-color: #ffd466 !important;
  background: linear-gradient(180deg, #2d1c0d 0%, #3d2612 100%) !important;
  box-shadow:
    inset 0 0 18px rgba(255, 212, 102, 0.35),
    0 0 18px rgba(255, 212, 102, 0.65) !important;
  transform: translateX(-2px);
}

.town-bin.drag-over strong {
  background: linear-gradient(180deg, #ffe082 0%, #d4a238 100%);
  box-shadow: 0 0 10px rgba(255, 224, 130, 0.7);
}
