/* Printed faces share a single design across the hand, rewards and collection. */
.gamecard {
  --metal: #cca979;
  --enamel: #4d394e;
  --rim: #c29ed0;
  --face-shadow: #201521;
  --paper: #eee0bc;
  width: 100%;
  max-width: 228px;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(57px, 1fr);
  align-content: start;
  position: relative;
  isolation: isolate;
  padding: 5px;
  overflow: visible;
  text-align: center;
  border: 2px solid #30271f;
  border-radius: 12px 12px 14px 14px;
  color: #301e19;
  background: linear-gradient(
    115deg,
    #feefc2 0%,
    var(--metal) 8%,
    #6a4c32 20%,
    #b59866 50%,
    #e8d4a1 73%,
    #6a4a32 96%
  );
  box-shadow:
    inset 0 0 0 1px #fbe3a5,
    inset 0 0 0 3px var(--face-shadow),
    0 3px 6px #090805ac;
  font-family: var(--display);
  transition:
    transform 160ms ease,
    box-shadow 140ms ease;
}
.gamecard.role-attack {
  --enamel: #75372e;
  --rim: #e4a088;
  --face-shadow: #45251c;
}
.gamecard.role-defend {
  --enamel: #2b5762;
  --rim: #96d2d4;
  --face-shadow: #1b3539;
}
.gamecard.role-prayer {
  --enamel: #6c4e21;
  --rim: #ecd384;
  --face-shadow: #47351d;
}
.gamecard.role-power {
  --enamel: #306455;
  --rim: #9cd3a7;
  --face-shadow: #173e32;
}
.gamecard::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 3px;
  border: 1px solid #eed4a377;
  border-radius: 8px 8px 11px 11px;
}
.gamecard .engravedName {
  display: grid;
  place-content: center;
  min-height: 38px;
  padding: 2px 4px 2px 19px;
  border-radius: 6px 6px 1px 1px;
  border: 1px solid #302721;
  border-bottom: 2px solid var(--metal);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--enamel), #fff 12%),
    var(--enamel) 50%,
    var(--face-shadow)
  );
  font: 700 clamp(0.85rem, 1.2vw, 1.12rem)/1.03 var(--display);
  color: #fff0cb;
  text-shadow: 0 1px 2px #130c08;
}
.gamecard .cost {
  width: 29px;
  height: 32px;
  top: 0;
  left: -4px;
  z-index: 3;
  color: #fff4d5;
  border-radius: 48% 48% 54% 54%;
  border: 2px solid #edd394;
  background: radial-gradient(
    ellipse at 34% 25%,
    #708d94,
    #335360 45%,
    #1b3039 72%
  );
  box-shadow:
    inset 0 0 0 1px #302c26,
    0 0 0 1px #37281c,
    0 2px 3px #1d171b;
  font: 700 1.13rem/1 var(--display);
  text-shadow: 0 1px 1px #151d22;
}
.paintWindow {
  display: block;
  position: relative;
  aspect-ratio: 1.48;
  overflow: hidden;
  border: 1px solid #5d4634;
  border-top: 0;
}
.gamecard .paintWindow img,
.battleHand .gamecard .paintWindow img {
  width: 100%;
  height: 100%;
  display: block;
  aspect-ratio: auto;
  object-fit: cover;
  border: 0;
}
.paintWindow:after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 10px #281b1655;
  pointer-events: none;
}
.gamecard .roleRibbon {
  z-index: 1;
  align-self: center;
  justify-self: center;
  min-width: 60%;
  max-width: 99%;
  padding: 3px 10px;
  margin: -7px 0 -7px;
  min-height: 19px;
  clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0 50%);
  border-block: 1px solid #e4c587;
  border-radius: 0;
  background: linear-gradient(var(--enamel), var(--face-shadow));
  color: #fff3d6;
  font: 700 0.61rem/1 var(--body);
  letter-spacing: 0.08em;
}
.gamecard .roleRibbon .emblem {
  width: 13px;
  height: 13px;
}
.gamecard .cardtext {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px 11px;
  min-height: 58px;
  border: 1px solid #806345;
  border-radius: 0 0 7px 7px;
  color: #32271e;
  background: radial-gradient(
    ellipse at 46% 40%,
    #f8eece 0%,
    var(--paper) 64%,
    #d1bc91 100%
  );
}
.gamecard .cardtext .rules {
  font: 600 clamp(0.76rem, 1vw, 0.91rem)/1.21 var(--display);
  color: #33271e;
  text-wrap: pretty;
}
.gamecard .cardtext .minor {
  color: #533761;
  margin: 3px 0 0;
}
.gamecard:is(:disabled, [aria-disabled="true"]) {
  border-color: #54483e;
  cursor: default;
}
.gamecard:is(:disabled, [aria-disabled="true"]) .paintWindow img {
  filter: saturate(0.58) brightness(0.84);
}
.gamecard:is(:disabled, [aria-disabled="true"]) .cost {
  background: radial-gradient(circle at 40% 30%, #995742, #552d28 70%);
}
.gamecard.playable:hover,
.gamecard:focus-visible {
  border-color: #80613b;
  box-shadow:
    inset 0 0 0 1px #fff3ce,
    0 0 0 2px var(--rim),
    0 5px 13px #100d0d99;
}
.catalog,
.reward-grid {
  justify-items: center;
  align-items: stretch;
}
.catalog > div {
  width: min(100%, 228px);
}
.reward-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 218px));
  justify-content: center;
  gap: clamp(15px, 3.5vw, 52px);
}
.reward-grid .gamecard {
  max-width: 218px;
}
.catalog .gamecard,
.reward-grid .gamecard {
  height: 100%;
  grid-template-rows: auto auto auto minmax(72px, 1fr);
}
.catalog > div .gamecard {
  height: auto;
}
.battleTray {
  position: relative;
  isolation: isolate;
  background: radial-gradient(ellipse at 50% 20%, #39372d, #1c201a 72%);
}
.battleHand {
  --card-w: clamp(142px, 13.1vw, 181px);
  --stride: min(
    calc(var(--card-w) * 0.78),
    calc((100% - var(--card-w) - 42px) / var(--intervals))
  );
  display: flex;
  align-items: flex-end;
  justify-content: safe center;
  position: relative;
  gap: 0;
  overflow: visible;
  scroll-snap-type: none;
  margin: 0 auto;
  padding: 10px 17px 16px;
  min-height: 215px;
  isolation: isolate;
  pointer-events: none;
}
.battleHand .handSlot {
  position: relative;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  min-width: 0;
  gap: 1px;
  align-self: flex-end;
  pointer-events: auto;
  scroll-snap-align: none;
}
.battleHand .handSlot + .handSlot {
  margin-left: calc(var(--stride) - var(--card-w));
}
.battleHand .handSlot > .gamecard {
  width: 100%;
  max-width: none;
  height: auto;
  min-height: 0;
  grid-template-rows: 36px auto auto minmax(64px, 1fr);
  transform: translateY(var(--fan-drop)) rotate(var(--fan-angle));
  transform-origin: 50% 94%;
  transition:
    transform 175ms cubic-bezier(0.19, 0.76, 0.23, 1),
    box-shadow 150ms ease;
}
.battleHand .handSlot > .gamecard .engravedName {
  font-size: clamp(0.86rem, 1.15vw, 1.04rem);
  min-height: 0;
}
.battleHand .handSlot:has(:focus-visible),
.battleHand .handSlot.hand-inspected {
  z-index: 6;
}
.battleHand .handSlot:has(:focus-visible) > .gamecard,
.battleHand .handSlot.hand-inspected > .gamecard {
  transform: translateY(-20px) rotate(0) scale(1.18);
  z-index: 1;
}
@media (hover: hover) and (pointer: fine) {
  .battleHand .handSlot:hover {
    z-index: 8;
  }
  .battleHand .handSlot:hover > .gamecard {
    transform: translateY(-20px) rotate(0) scale(1.18);
  }
}
.battleHand .handSlot > .prepareCard {
  position: relative;
  align-self: center;
  z-index: 2;
  min-height: 26px;
  padding: 2px 10px;
}
.battleHand .handSlot.card-spent {
  pointer-events: none;
  z-index: 9;
}
.battleHand .handSlot.card-spent > .gamecard {
  transform: translateY(-50px) scale(0.94);
  opacity: 0;
  transition:
    transform 0.22s ease-out,
    opacity 0.19s ease-in;
}
.turnTools {
  position: relative;
  z-index: 2;
  pointer-events: none;
}
.turnTools button {
  pointer-events: auto;
}
.handGestureStatus {
  font: 600 0.81rem/1.15 var(--body);
  color: #f2dfbd;
}
.powerRail {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 9px;
  padding: 7px 0 2px;
  color: #bbdac3;
}
.powerRail > span {
  font: 700 0.7rem var(--body);
  letter-spacing: 0.04em;
}
.powerSeal {
  position: relative;
  z-index: 12;
}
.powerSeal summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid #809d81;
  border-radius: 12px;
  color: #f5eac8;
  background: #253f32;
  font: 600 0.82rem var(--display);
}
.powerSeal summary::-webkit-details-marker {
  display: none;
}
.powerSeal svg {
  width: 16px;
  height: 16px;
  color: #c7dea4;
}
.powerSeal p {
  position: absolute;
  z-index: 14;
  bottom: 100%;
  left: 0;
  padding: 9px 12px;
  width: min(205px, 55vw);
  background: #1c3129;
  color: #fff2d2;
  border: 1px solid #8e9d79;
  font-size: 0.83rem;
  box-shadow: 0 3px 8px #141b18aa;
}
@media (min-width: 701px) {
  .field {
    height: clamp(315px, min(32vw, 48vh), 442px);
  }
  .battleHand {
    width: calc(100% - 150px);
    min-height: 205px;
  }
  .turnTools {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 65px;
    z-index: 3;
  }
  .turnTools .handTitle {
    position: absolute;
    bottom: -34px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
  }
  .turnActions {
    grid-column: 3;
    flex-direction: column;
  }
  .energyWrap {
    align-self: center;
  }
}
@media (max-width: 700px) {
  .battleHand {
    --card-w: 138px;
    --stride: clamp(
      35px,
      calc((100% - var(--card-w) - 45px) / var(--intervals)),
      100px
    );
    width: 100%;
    min-height: 235px;
    padding: 35px 12px 10px;
    overflow-x: auto;
    align-items: flex-end;
    scrollbar-width: thin;
  }
  .battleHand .handSlot > .gamecard {
    grid-template-rows: 31px auto auto minmax(60px, 1fr);
    transform: translateY(calc(var(--fan-drop) * 0.65))
      rotate(calc(var(--fan-angle) * 0.65));
  }
  .battleHand .handSlot > .gamecard .engravedName {
    font-size: 0.86rem;
  }
  .battleHand .handSlot:has(:focus-visible) > .gamecard,
  .battleHand .handSlot.hand-inspected > .gamecard {
    transform: translateY(-9px) rotate(0) scale(1.07);
  }
  .handGestureStatus {
    font-size: 0.7rem;
  }
  .gamecard .cardtext .rules {
    font-size: 0.78rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .battleHand .handSlot > .gamecard {
    transition: none;
  }
}
