/* Heat exchanger plate-stacking puzzle · game page styles (en/zh share this file) */
[hidden] { display: none !important; }

.game-stage {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}
.game-stage svg { display: block; width: 100%; height: auto; touch-action: manipulation; }

.hud {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
}
.hud b { color: #2563eb; font-weight: 800; }
.hud .err b { color: #be123c; }
#hintBtn {
  border: 2px solid #cbe0ff;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 16px;
  font-family: inherit;
  transition: all 0.2s;
}
#hintBtn:hover { background: #dbeafe; }
#hintBtn:disabled { opacity: 0.45; cursor: default; }

.tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  padding: 16px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}
.part-chip {
  width: 92px;
  padding: 10px 6px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: grab;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  user-select: none;
  touch-action: none;
  -webkit-user-select: none;
}
.part-chip:hover { border-color: #93c5fd; background: #eff6ff; transform: translateY(-2px); }
.part-chip:active { cursor: grabbing; }
.part-chip svg { width: 44px; height: 44px; pointer-events: none; }
.part-chip .chip-name { font-size: 12px; color: #475569; text-align: center; font-weight: 600; pointer-events: none; }
.part-chip.flash-out { opacity: 0; transform: scale(0.8); transition: opacity 0.25s, transform 0.25s; }

.status-bar {
  margin-top: 14px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  min-height: 22px;
}
.status-bar .hl { color: #2563eb; font-weight: 800; }
.status-bar .ok { color: #047857; font-weight: 800; }
.status-bar .no { color: #be123c; font-weight: 800; }

.controls {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.game-frame .btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  padding: 10px 24px;
  font-family: inherit;
  transition: all 0.2s;
}
.game-frame .btn.primary { background: #2563eb; color: #ffffff; }
.game-frame .btn.ghost { background: #f1f5f9; color: #475569; }
.game-frame .btn:hover { opacity: 0.88; transform: translateY(-1px); }
.game-frame .btn:active { transform: translateY(0); }

.result {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  margin-top: 14px;
  padding: 26px 20px;
  text-align: center;
}
.result h2 { font-size: 20px; color: #1e293b; margin-bottom: 10px; }
.result-line { font-size: 15px; color: #475569; margin-bottom: 16px; line-height: 1.7; }
.result-line strong { color: #2563eb; font-size: 18px; font-weight: 800; }

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  width: 86px;
  margin-left: -43px;
  margin-top: -43px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 2px solid #2563eb;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.3);
  pointer-events: none;
  opacity: 0.95;
}
.drag-ghost svg { width: 40px; height: 40px; }
.drag-ghost span { font-size: 12px; color: #2563eb; font-weight: 700; }

/* ---------------- SVG part / label visibility ---------------- */
.part { opacity: 0; transition: opacity 0.3s ease; }
.part.visible { opacity: 1; }
.part.snap { animation: snapIn 0.42s ease; }
@keyframes snapIn {
  0%   { opacity: 0.15; transform: scale(0.7); }
  60%  { opacity: 1;    transform: scale(1.06); }
  100% { opacity: 1;    transform: scale(1); }
}
.part { transform-box: fill-box; transform-origin: center; }

.label { opacity: 0; transition: opacity 0.4s ease; }
.label.visible { opacity: 1; }

/* ---------------- dashed drop zones ---------------- */
.ghost { transform-box: fill-box; transform-origin: center; transition: opacity 0.3s ease; }
.ghost path, .ghost rect, .ghost circle, .ghost line { transition: stroke 0.15s ease; }
.ghost.near path, .ghost.near rect, .ghost.near circle, .ghost.near line { stroke: #16a34a; stroke-width: 3; }
.ghost.near text { fill: #047857; }
.ghost.hint path, .ghost.hint rect, .ghost.hint circle, .ghost.hint line { stroke: #2563eb; stroke-width: 3; }
.ghost.hint text { fill: #2563eb; }
.ghost.hint { animation: zonePulse 1.2s ease-in-out 2; }
@keyframes zonePulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.ghost.shakeZone { animation: zoneShake 0.4s ease; }
@keyframes zoneShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
.ghost.placed { opacity: 0; pointer-events: none; }

/* ---------------- idle flow animation ---------------- */
.flow { stroke-dasharray: 10 12; animation: hxFlow 1s linear infinite; }
@keyframes hxFlow { to { stroke-dashoffset: -22; } }

@media (max-width: 480px) {
  .hud { font-size: 13px; gap: 8px 12px; }
  .part-chip { width: 78px; }
  .tray { gap: 9px; padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .part, .label { transition: none; }
  .part.snap { animation: none; }
  .ghost, .ghost path, .ghost rect, .ghost circle, .ghost line { transition: none; }
  .ghost.hint, .ghost.shakeZone { animation: none; }
  .part-chip, .game-frame .btn, #hintBtn { transition: none; }
  .flow { animation: none; }
}