/* throw — tap deck/pile to throw & draw, swipe/double-tap to throw, smart selection (js/throw.js) */

/* The Discard button is replaced by the gestures; the element stays in the DOM for old tests. */
#discardBtn, .bottom-row .discard-tag { display: none !important; }

/* ---- smart selection: ghost outline + "+" badge on companion cards ---- */
.hand .card.tw-companion {
  outline: 2px dashed rgba(255, 228, 130, 0.9);
  outline-offset: 2px;
  translate: 0 -5px;
}
.hand .card .tw-plus {
  position: absolute; z-index: 5; top: -8px; right: -7px;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  font: 800 14px/1 "Fredoka", system-ui, sans-serif;
  color: #4a2a0e; background: linear-gradient(180deg, #fff0a6, #ffcf3f);
  border: 1.5px solid #a8650a;
  box-shadow: 0 2px 5px rgba(60, 40, 15, 0.35);
  pointer-events: none;
  animation: twPop 0.22s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes twPop { from { scale: 0.3; opacity: 0; } to { scale: 1; opacity: 1; } }
.hand .card:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* ---- swipe-up drag ---- */
.hand .card.tw-drag {
  z-index: 40;
  box-shadow: var(--card-edge), 0 18px 26px -8px rgba(0, 0, 0, 0.45);
  will-change: transform;
}
.hand .card.tw-drag::after { opacity: 1; }

/* ---- throw targets (discard phase with a legal selection) ---- */
.table.tw-armed .deck-swirl { cursor: pointer; }
.deck-swirl.tw-target .yaniv-back { animation: none; }
.deck-swirl.tw-target .yaniv-back::before { animation: twTargetPulse 1.1s ease-in-out infinite; }
#pile .card.tw-target { cursor: pointer; z-index: 30 !important; }
#pile .card.tw-target::after {
  box-shadow: 0 0 0 2.5px #fff6c8, 0 0 0 5px rgba(255, 205, 50, 0.95), 0 0 20px 4px rgba(255, 200, 40, 0.85);
  animation: twTargetPulse 1.1s ease-in-out infinite;
}
@keyframes twTargetPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* "Tap where to draw" chip under the deck + pile */
.table-center .tw-hint {
  position: absolute; left: 50%; top: 100%; margin-top: 4px;
  transform: translate(-50%, 4px);
  white-space: nowrap; pointer-events: none;
  font: 700 11px/1 "Fredoka", system-ui, sans-serif; letter-spacing: 0.6px; text-transform: uppercase;
  color: #4a2a0e; background: rgba(255, 244, 196, 0.96);
  border: 1.5px solid #b3700a; border-radius: 999px; padding: 5px 11px;
  box-shadow: 0 3px 8px rgba(60, 40, 15, 0.3);
  opacity: 0; transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 6;
}
.table-center .tw-hint.on { opacity: 1; transform: translate(-50%, 0); }
.table-center .tw-hint::before {
  content: ""; position: absolute; left: 50%; top: -5px; width: 8px; height: 8px;
  transform: translateX(-50%) rotate(45deg);
  background: inherit; border-left: 1.5px solid #b3700a; border-top: 1.5px solid #b3700a;
}

/* ---- one-time coach marks ---- */
.tw-tip {
  position: absolute; z-index: 60;
  padding: 12px 14px 10px; border-radius: 14px;
  color: #3b2210; background: #fff8e1;
  border: 2px solid #b3700a;
  box-shadow: 0 10px 26px rgba(30, 18, 6, 0.4);
  font: 500 13px/1.35 "Fredoka", system-ui, sans-serif;
  animation: twTipIn 0.24s cubic-bezier(.2, 1.3, .4, 1) both;
}
.tw-tip b { display: block; font-size: 15px; margin: 0 22px 3px 0; color: #4a2a0e; }
.tw-tip p { margin: 0 0 8px; }
.tw-tip::after {
  content: ""; position: absolute; left: var(--ax, 50%); bottom: -8px; width: 12px; height: 12px;
  transform: translateX(-50%) rotate(45deg);
  background: #fff8e1; border-right: 2px solid #b3700a; border-bottom: 2px solid #b3700a;
}
.tw-tip.below::after { bottom: auto; top: -8px; border: 0; border-left: 2px solid #b3700a; border-top: 2px solid #b3700a; }
.tw-tip .tw-x {
  position: absolute; top: 4px; right: 6px; width: 30px; height: 30px;
  border: 0; background: none; color: #7a5020; font-size: 20px; line-height: 1; cursor: pointer;
}
.tw-tip .tw-row { display: flex; align-items: center; justify-content: space-between; }
.tw-tip .tw-dots i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: rgba(120, 70, 10, 0.25); }
.tw-tip .tw-dots i.on { background: #b3700a; }
.tw-tip .tw-next {
  border: 2px solid #a8650a; border-radius: 999px; padding: 5px 14px; cursor: pointer;
  font: 700 12px/1 "Fredoka", system-ui, sans-serif; letter-spacing: 0.5px; text-transform: uppercase;
  color: #4a2a0e; background: linear-gradient(180deg, #fff0a6, #ffd447 55%, #f3b72a);
}
@keyframes twTipIn { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .hand .card .tw-plus, .tw-tip { animation: none; }
  .deck-swirl.tw-target .yaniv-back::before, #pile .card.tw-target::after { animation: none; opacity: 1; }
  .table-center .tw-hint { transition: none; }
}

/* the first-time tip never blocks the deck, pile or hand: only its buttons take taps */
.tw-tip { pointer-events: none; }
.tw-tip button, .tw-tip [role="button"] { pointer-events: auto; }

/* Matching draw: glow the card and offer a one-tap throw */
#hand .card.slap-ready { outline: 3px solid #ffd257; outline-offset: 2px; box-shadow: 0 0 18px rgba(255, 196, 60, .75); }
.slap-btn {
  position: absolute; left: 50%; top: -14px; translate: -50% -100%; z-index: 70;
  padding: 9px 16px; border: 0; border-radius: 999px; background: linear-gradient(#ffd96b, #f3b331);
  color: #3a2300; font: 700 15px/1.1 Fredoka, system-ui, sans-serif; white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .28); cursor: pointer; animation: slapIn .22s ease-out both;
}
.slap-btn:active { scale: .95; }
@keyframes slapIn { from { opacity: 0; translate: -50% calc(-100% + 8px); } to { opacity: 1; translate: -50% -100%; } }
@media (prefers-reduced-motion: reduce) { .slap-btn { animation: none; } }
