.controls { flex-wrap: wrap; }
#scanDialog, #scanSwitchDialog { color: #eaf4ff; background: #0b1726; border: 1px solid #34475d; border-radius: 20px; width: min(620px, calc(100vw - 36px)); max-height: 88dvh; padding: 20px; box-sizing: border-box; overflow-y: auto; }
#scanDialog::backdrop, #scanSwitchDialog::backdrop { background: #000a; backdrop-filter: blur(4px); }
.scan-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scan-heading h2 { margin: 0; }
#scanClose, #scanSwitchClose { background: #25364b; color: white; font-size: 24px; }
.scan-subtitle { margin: 12px 0 0; font-size: 17px; }
.scan-status { color: #ffda78; min-height: 1.5em; }
.scan-status:empty { display: none; }
.scan-hint { color: #aec1d9; line-height: 1.5; font-size: 14px; }
.scan-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
#scanStatus, #scanReportStatus { line-height: 1.5; }
#scanReportStatus { color: #b9cbe0; min-height: 1.5em; }
#scanPreview { display: block; width: 100%; max-height: 330px; margin: 14px 0; object-fit: contain; background: #07101a; }
#scanDialog button:disabled { opacity: .45; cursor: not-allowed; }
#scanDialog [hidden] { display: none; }
/* Animate the actual hand; removing the class restores its existing layout. */
.scan-progress { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 16px; text-align: center; margin: 0 auto 16px; padding: 0 12px; }
.scan-progress[hidden] { display: none; }
.scan-progress p { margin: 0; color: #ffda78; line-height: 1.5; }
.hand-area.is-scanning .card { pointer-events: none; cursor: default; animation: table-shuffle 2.4s ease-in-out infinite; }
.hand-area.is-scanning .card:nth-child(2) { animation-delay: -.3s; }
.hand-area.is-scanning .card:nth-child(3) { animation-delay: -.6s; }
.hand-area.is-scanning .card:nth-child(4) { animation-delay: -.9s; }
.hand-area.is-scanning .card:nth-child(5) { animation-delay: -1.2s; }
.hand-area.is-scanning .card:nth-child(6) { animation-delay: -1.5s; }
.hand-area.is-scanning .card:nth-child(7) { animation-delay: -1.8s; }
.hand-area.is-scanning .card:nth-child(8) { animation-delay: -2.1s; }
@keyframes table-shuffle {
  0%, 100% { transform: translate(-50%, -50%) translate(-28px, 6px) rotate(-9deg); z-index: 1; }
  30% { transform: translate(-50%, -50%) translate(65px, -16px) rotate(14deg); z-index: 9; }
  60% { transform: translate(-50%, -50%) translate(0, -6px) rotate(0); z-index: 8; }
  80% { transform: translate(-50%, -50%) translate(-55px, 8px) rotate(-12deg); z-index: 2; }
}
@media (prefers-reduced-motion: reduce) {
  .hand-area.is-scanning .card { animation: none; }
}

#scanSwitchDialog { width: min(460px, calc(100vw - 36px)); }
#scanSwitchText { line-height: 1.5; }

.scan-card-list { position: relative; width: 100%; aspect-ratio: 1.5; margin: 16px 0; }
.scan-card-list img {
  position: absolute;
  left: calc(50% + var(--fan-offset) * 9%);
  top: calc(8% + var(--fan-drop));
  width: 32%;
  height: auto;
  object-fit: contain;
  transform: translateX(-50%) rotate(var(--fan-angle));
  border-radius: 5px;
  box-shadow: 0 3px 8px #0006;
}
