/* ============================================================
   BOARD HAND - a floating card fan. Kept separate from cards.css
   because collection and deck-builder cards should remain neutral.
   ============================================================ */

#screen-game .hand-area {
  --hand-rail: rgba(242, 202, 80, 0.34);
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0;
  width: min(72vw, 760px);
  min-height: 176px;
  margin: 0 auto 18px;
  padding: 10px 16px 2px;
  border: 0;
  border-top: 1px solid var(--hand-rail);
  border-radius: 50% 50% 0 0 / 18% 18% 0 0;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(242, 202, 80, 0.13), transparent 62%),
    linear-gradient(180deg, transparent, rgba(9, 3, 1, 0.32));
  box-shadow: none;
  overflow: visible;
}

#screen-game .hand-area::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 46px;
  height: 9px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #221105;
  box-shadow: 0 0 0 1px rgba(242, 202, 80, 0.2);
}

#screen-game .hand-card {
  --hand-angle: 0deg;
  --hand-rest-y: 0px;
  width: clamp(112px, 10.4vw, 154px);
  margin-left: clamp(-42px, -2.6vw, -18px);
  border-color: rgba(183, 139, 60, 0.82);
  border-radius: 6px;
  transform: translateY(var(--hand-rest-y)) rotate(var(--hand-angle));
  transform-origin: 50% 118%;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.54), inset 0 0 0 1px rgba(255, 226, 168, 0.11);
}

#screen-game .hand-card:first-child { margin-left: 0; }

#screen-game .hand-card:hover {
  transform: translateY(calc(var(--hand-rest-y) - 28px)) rotate(var(--hand-angle)) scale(1.08);
  z-index: 40;
  box-shadow: 0 22px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(242, 202, 80, 0.3), inset 0 0 0 1px rgba(255, 232, 174, 0.2);
}

#screen-game .hand-card.selected {
  outline: 0;
  transform: translateY(calc(var(--hand-rest-y) - 34px)) rotate(var(--hand-angle)) scale(1.08);
  border-color: #ffe088;
  z-index: 40;
  box-shadow: 0 22px 34px rgba(0, 0, 0, 0.7), 0 0 0 2px rgba(242, 202, 80, 0.72), 0 0 28px rgba(242, 202, 80, 0.38);
}

#screen-game .hand-card .card-cost {
  top: -7px;
  left: -6px;
  width: 25px;
  height: 29px;
  z-index: 20;
  /* The artwork moves forward for the 3D tilt. Keep UI overlays in front
     in the same 3D space so browsers cannot paint the art over the mana. */
  transform: translateZ(12px);
  backface-visibility: hidden;
}

#screen-game .hand-card .card-badges {
  top: 25px;
  left: -6px;
  width: 25px;
  align-items: center;
  z-index: 20;
  transform: translateZ(12px);
  backface-visibility: hidden;
}

#screen-game .hand-card .card-footer {
  z-index: 20;
  transform: translateZ(12px);
  backface-visibility: hidden;
}

@media (max-width: 900px) and (orientation: landscape) {
  #screen-game .hand-area { width: min(62vw, 530px); min-height: 92px; margin-bottom: 10px; padding: 4px 9px 0; }
  #screen-game .hand-card { width: clamp(62px, 10vw, 88px); margin-left: clamp(-25px, -2.7vw, -11px); }
  #screen-game .hand-card .card-cost { width: 18px; height: 21px; top: -5px; left: -5px; font-size: 9px; }
  #screen-game .hand-card .card-badges { top: 18px; left: -5px; width: 18px; }
}

@media (max-width: 720px) and (orientation: portrait) {
  #screen-game .hand-area { width: min(100%, 430px); min-height: 118px; margin-bottom: 10px; padding: 5px 8px 0; }
  #screen-game .hand-card { width: clamp(76px, 21vw, 102px); margin-left: clamp(-31px, -7.2vw, -17px); }
  #screen-game .hand-card .card-cost { width: 22px; height: 25px; top: -6px; left: -5px; font-size: 10px; }
  #screen-game .hand-card .card-badges { top: 23px; left: -5px; width: 22px; }
  #screen-game .hand-card:hover { transform: translateY(calc(var(--hand-rest-y) - 18px)) rotate(var(--hand-angle)) scale(1.03); }
}
