.mesa-hand {
  --card-width: clamp(62px, 7vw, 94px);
  color: #39342b;
  padding: 12px;
  border: 1px solid #fff8e6c9;
  border-radius: 22px;
  background: #fff8e6df;
  backdrop-filter: blur(12px);
  box-shadow: 0 5px 18px #39342b12;
  max-width: 100%;
}
.mesa-hand-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
  margin-bottom: 12px;
}
.mesa-hand-heading span {
  font-size: 0.85rem;
  font-weight: 600;
}
.mesa-hand-table {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}
.mesa-card {
  --card-color: #e6dcc4;
  display: inline-flex;
  position: relative;
  flex-shrink: 0;
  width: var(--card-width, 84px);
  aspect-ratio: 2/3;
  padding: 5px;
  border: 2px solid #39342b;
  border-radius: 14px;
  background: #fff8e6;
  box-shadow: 0 4px 0 #39342b24;
  color: #39342b;
  vertical-align: middle;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
button.mesa-card {
  cursor: pointer;
}
.mesa-card.mesa-tile {
  aspect-ratio: 1/2;
  border-radius: 12px;
  background: #fff8e6;
}
.mesa-tile .mesa-card-face {
  background: #f3e8cd;
  border-radius: 7px;
}
.mesa-tile-half {
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  gap: 7%;
  padding: 12%;
  width: 100%;
  height: 50%;
  box-sizing: border-box;
}
.mesa-tile-half + .mesa-tile-half {
  border-top: 2px solid #39342b80;
}
.mesa-tile-pip {
  display: block;
  border-radius: 50%;
  aspect-ratio: 1;
  align-self: center;
}
.mesa-tile-pip.is-filled {
  background: #39342b;
  box-shadow:
    inset 0 2px 1px #0004,
    0 1px 0 #fff9;
}
button.mesa-card:disabled {
  cursor: default;
  filter: saturate(0.65);
}
.mesa-card-face {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 9px;
  background: var(--card-color);
  box-shadow:
    inset 0 3px 1px #ffffff65,
    inset 0 -4px 0 #39342b15;
}
.mesa-card-corner {
  position: absolute;
  left: 5px;
  top: 3px;
  font-size: 0.8rem;
  font-weight: 900;
  background: #fff8e6df;
  padding: 0 3px;
  border-radius: 4px;
}
.mesa-card-value {
  font-size: clamp(18px, 2.2vw, 30px);
  font-weight: 900;
  background: #fff8e6f2;
  border-radius: 8px;
  padding: 0 5px;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mesa-card-symbol {
  display: block;
  width: 42%;
  aspect-ratio: 1;
  background: #fff8e6;
  box-shadow:
    inset 0 3px 0 #ffffff9c,
    inset 0 -3px 0 #39342b24;
  border-radius: 50%;
  margin: 7px 0;
}
.mesa-card-symbol.symbol-square {
  border-radius: 6px;
}
.mesa-card-symbol.symbol-triangle {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  border-radius: 0;
}
.mesa-card-symbol.symbol-diamond {
  transform: rotate(45deg) scale(0.8);
  border-radius: 5px;
}
.mesa-card-symbol.symbol-star {
  clip-path: polygon(
    50% 0,
    61% 35%,
    100% 38%,
    70% 61%,
    80% 100%,
    50% 77%,
    20% 100%,
    30% 61%,
    0 38%,
    39% 35%
  );
  border-radius: 0;
}
.mesa-card-symbol.symbol-heart {
  clip-path: polygon(
    50% 100%,
    5% 50%,
    0 20%,
    20% 0,
    40% 5%,
    50% 20%,
    60% 5%,
    80% 0,
    100% 20%,
    95% 50%
  );
}
.mesa-card-symbol.symbol-spade {
  clip-path: polygon(
    50% 0,
    95% 45%,
    100% 70%,
    75% 80%,
    58% 65%,
    65% 100%,
    35% 100%,
    42% 65%,
    25% 80%,
    0 70%,
    5% 45%
  );
  border-radius: 0;
}
.mesa-card-symbol.symbol-club {
  clip-path: polygon(
    50% 0,
    75% 15%,
    70% 35%,
    95% 40%,
    100% 65%,
    80% 80%,
    58% 70%,
    65% 100%,
    35% 100%,
    42% 70%,
    20% 80%,
    0 65%,
    5% 40%,
    30% 35%,
    25% 15%
  );
}
.mesa-card.is-closed .mesa-card-face {
  background: #2446ed;
}
.mesa-card-back-mark {
  width: 65%;
  aspect-ratio: 1;
  border: 8px solid #ffda55;
  border-radius: 35%;
  transform: rotate(15deg);
  box-shadow:
    0 3px 0 #0002,
    inset 0 3px 0 #0002;
}
.mesa-hand-cards {
  display: flex;
  gap: 10px;
  padding: 12px 3px 9px;
  overflow-x: auto;
  align-items: flex-end;
}
.mesa-card.is-selected {
  transform: translateY(-9px);
  box-shadow: 0 5px 0 #2446ed;
}
.mesa-card:focus-visible {
  outline: 3px solid #2446ed;
  outline-offset: 3px;
}
.mesa-hand-pile,
.mesa-hand-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}
.mesa-hand-discard {
  display: flex;
  position: relative;
  min-width: var(--card-width);
  min-height: calc(var(--card-width) * 1.5);
  justify-content: center;
  align-items: center;
  border: 2px dashed #a29983;
  border-radius: 16px;
}
.mesa-hand-discard .mesa-card:not(:last-child) {
  position: absolute;
  transform: rotate(-6deg);
}
.mesa-hand-empty {
  font-size: 0.8rem;
}
.mesa-hand.is-dragging .mesa-hand-discard {
  border-color: #2446ed;
  background: #2446ed15;
}
.mesa-hand-confirmation {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.mesa-hand-confirmation[hidden] {
  display: none;
}
.mesa-card.is-arriving {
  animation: mesa-card-arrive 0.35s ease-out both;
}
@keyframes mesa-card-arrive {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mesa-card {
    transition: none;
  }
  .mesa-card.is-arriving {
    animation: none;
  }
}
@media (max-width: 480px) {
  .mesa-hand {
    padding: 9px;
    --card-width: 66px;
  }
  .mesa-hand-table {
    gap: 12px;
    margin-bottom: 6px;
  }
  .mesa-hand-cards {
    gap: 8px;
  }
}
