/* Look & feel: motion, timer urgency, confetti, score leader. Motion respects reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  #stage > .stage-card { animation: stage-in 260ms cubic-bezier(.2, .8, .3, 1) both; }
  #stage .stage-card .prompt { animation: prompt-pop 320ms 60ms cubic-bezier(.2, 1.4, .4, 1) both; }
  .timer.low { animation: timer-pulse 1s ease-in-out infinite; }
  .game-card .game { transition: transform 140ms ease, box-shadow 140ms ease; }
  .game-card .game:hover { transform: translateY(-2px); }
  dialog[open] { animation: dialog-in 200ms ease-out both; }
}
@keyframes stage-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes prompt-pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes timer-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.timer { display: inline-block; font-variant-numeric: tabular-nums; }
.timer.low { color: #e0213f; }

/* Score leader */
.score.leader span::before, .score-panel span.leader::before { content: "👑 "; }
.score.leader, .score-panel span.leader { outline: 2px solid #f6d675; outline-offset: 1px; }

/* Confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1000; }
.confetti i {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: .95;
  animation: confetti-fall var(--fall, 1.8s) cubic-bezier(.25, .6, .4, 1) var(--delay, 0s) forwards;
}
@keyframes confetti-fall {
  to { transform: translate(var(--drift, 0), calc(105vh / var(--site-zoom, 1))) rotate(var(--spin, 540deg)); opacity: .9; }
}
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* Reaction duel */
.reflex-card { padding: 10px !important; }
.reflex-arena { display: grid; grid-template-rows: 1fr auto 1fr; gap: 10px; height: clamp(340px, calc(calc(100dvh / var(--site-zoom, 1)) - 250px), 600px); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.reflex-pad {
  display: grid; place-content: center; gap: 4px;
  border: 2px solid var(--ink); border-radius: 18px;
  background: #ff9daa; color: #20172b;
  font: inherit; font-size: 22px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reflex-pad span { font-size: 44px; font-weight: 800; line-height: 1; }
.reflex-top { transform: rotate(180deg); }
.reflex-pad:active { transform: none; }
.reflex-top:active { transform: rotate(180deg); }
.reflex-arena[data-state="go"] .reflex-pad { background: #a8eb69; }
.reflex-arena[data-state="done"] .reflex-pad { background: #e8e2d0; }
.reflex-signal { text-align: center; font-size: 28px; font-weight: 800; padding: 6px; }
.reflex-arena[data-state="go"] .reflex-signal { color: #2f7a12; }

/* 13: the play that was just beaten stays visible, smaller and faded. */
.thirteen-table .table-felt .thirteen-previous { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px 6px; margin-top: 6px; opacity: .65; }
.thirteen-table .table-felt .thirteen-previous .last-play-label { margin: 0; }
.thirteen-table .table-felt .thirteen-previous .playing-cards { gap: 2px; }
.thirteen-table .table-felt .thirteen-previous .playing-card { width: clamp(18px, calc(5vw / var(--site-zoom, 1)), 32px); padding: 1px; font-size: .78em; }
@media (max-width: 550px) {
  .thirteen-table .table-felt { padding-bottom: 14px; }
  .thirteen-table .table-felt .thirteen-previous .last-play-label { flex-basis: 100%; font-size: 9px; }
}

/* 13 hand: drag to reorder, quick sort, and the tappable hand-type helper. */
.thirteen-hand .hand-head { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 12px; }
.thirteen-hand .hand-sort { display: flex; gap: 6px; }
.thirteen-hand .hand-sort button { min-height: 36px; padding: 4px 10px; font-size: 12px; box-shadow: none; }
.thirteen-hand .hand-tip { margin: 2px 0 6px; font-size: 11px; opacity: .75; }
.thirteen-hand > .playing-cards .playing-card { touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; }
.thirteen-hand > .playing-cards .playing-card.card-dragging {
  position: relative;
  z-index: 6;
  cursor: grabbing;
  transition: none !important;
  box-shadow: 0 10px 22px #25204655;
}
.thirteen-hand .playing-card.card-hint { outline: 3px solid #f5b400; outline-offset: 1px; }
#roomMain .card-game-stage .thirteen-hand .playing-card.card-hint { outline: 3px solid #f5b400; }
.thirteen-side .hand-guide-tip { margin: 4px 0 0; font-size: 12px; }
.thirteen-side .hand-types button {
  min-height: 36px;
  padding: 4px 10px;
  font-size: 13px;
  box-shadow: none;
  border: 1px solid var(--ui-border, var(--ink));
  background: var(--ui-hover, #e6d6ff);
  color: inherit;
}
.thirteen-side .hand-types button[aria-pressed="true"] { background: #f5b400; color: #251733; border-color: #251733; }
.thirteen-side .hand-type-combos { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 6px; }
.thirteen-side .hand-type-combos:empty { display: none; }
.thirteen-side .hand-combo {
  min-height: 36px;
  padding: 4px 9px;
  font-size: 13px;
  box-shadow: none;
  border: 1px solid #f5b400;
  background: #fff3cf;
  color: #251733;
  font-variant-numeric: tabular-nums;
}
.thirteen-side .hand-combo-blocked { opacity: .5; }
.thirteen-side .hand-type-combos small { align-self: center; font-size: 12px; opacity: .75; }
