/* Hand Cards: the Live Hand Seeker strip under the South Rack and the Hands reference. */

.hand-seeker {
  --hs-ivory: #f4ecd6;
  --hs-ivory-edge: #cbbd98;
  --hs-ink: #1f3a2e;
  --hs-ink-soft: rgba(31, 58, 46, 0.66);
  --hs-gold: #e2bf63;
  --hs-gold-deep: #9a7426;
  --hs-ghost: rgba(236, 232, 216, 0.72);
  --hs-gap: 0.5rem;
  --hs-card-h: 4.15rem;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
}

.hand-seeker[hidden] {
  display: none;
}

.hs-strip {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  display: grid;
  width: 0;
  min-width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--hs-gap);
  min-height: var(--hs-card-h);
  margin: 0;
  padding: 0;
  list-style: none;
}

.hs-strip:has(> .hs-card:nth-child(4):not(.is-leaving)) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hs-note {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  margin: 0;
  color: rgba(232, 238, 230, 0.48);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.hs-note[hidden] {
  display: none;
}

.hs-card {
  --c: 0.5;
  position: relative;
  min-width: 0;
  container-type: inline-size;
  transition:
    translate 0.46s cubic-bezier(0.22, 0.8, 0.24, 1),
    opacity 0.38s ease,
    transform 0.38s cubic-bezier(0.22, 0.8, 0.24, 1);
}

.hs-card.is-entering {
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  transition: none;
}

.hs-card.is-leaving {
  position: absolute;
  margin: 0;
  pointer-events: none;
  animation: hs-leave 0.42s ease forwards;
}

.hs-card-body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name bonus"
    "pips pips"
    "progress away";
  align-content: center;
  gap: 0.26rem 0.4rem;
  box-sizing: border-box;
  width: 100%;
  height: var(--hs-card-h);
  margin: 0;
  padding: 0.42rem 0.6rem 0.46rem;
  overflow: hidden;
  border: 1px dashed rgba(244, 236, 214, 0.26);
  border-radius: 0.62rem;
  background: rgba(244, 236, 214, calc(0.03 + 0.08 * var(--c)));
  color: var(--hs-ghost);
  font: inherit;
  text-align: left;
  cursor: pointer;
  opacity: calc(0.42 + 0.58 * var(--c));
  filter: saturate(calc(0.35 + 0.65 * var(--c)));
  transform: translateY(calc((1 - var(--c)) * 2px)) scale(calc(0.95 + 0.05 * var(--c)));
  transition:
    background-color 0.45s ease,
    border-color 0.45s ease,
    color 0.45s ease,
    box-shadow 0.45s ease,
    opacity 0.45s ease,
    filter 0.45s ease,
    transform 0.45s cubic-bezier(0.22, 0.8, 0.24, 1);
  -webkit-tap-highlight-color: transparent;
}

.hs-card-body:focus-visible {
  outline: 2px solid var(--hs-gold);
  outline-offset: 2px;
}

.hs-card-head,
.hs-card-foot {
  display: contents;
}

.hs-card-name {
  grid-area: name;
  min-width: 0;
  overflow: hidden;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.hs-card-bonus {
  grid-area: bonus;
  font-size: 0.9rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1;
}

.hs-card-suit {
  display: none;
}

.hs-pips {
  grid-area: pips;
  display: flex;
  gap: 2px;
  min-width: 0;
  height: 0.3rem;
}

.hs-pip {
  flex: 1 1 0;
  min-width: 0;
  max-width: 1.6rem;
  border-radius: 999px;
  background: rgba(244, 236, 214, 0.16);
  transition: background-color 0.45s ease;
}

.hs-pip.is-on {
  background: rgba(244, 236, 214, 0.62);
}

.hs-card-progress,
.hs-card-away {
  min-width: 0;
  overflow: hidden;
  font-size: 0.62rem;
  font-weight: 650;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hs-card-progress {
  grid-area: progress;
  opacity: 0.86;
}

.hs-card-away {
  grid-area: away;
  font-weight: 800;
  text-align: right;
}

.hs-card-check {
  position: absolute;
  top: 0.34rem;
  right: 0.42rem;
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--hs-ink);
  color: var(--hs-gold);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  transform: scale(0.3) rotate(-20deg);
  transition: opacity 0.2s ease, transform 0.32s cubic-bezier(0.3, 1.6, 0.5, 1);
}

/* Tiers: a speculative Hand is a ghost; a strong one is card stock; ready and complete glow gold. */

.hs-card[data-tier="possible"] .hs-card-body {
  border-style: solid;
  border-color: rgba(244, 236, 214, 0.32);
}

.hs-card:is([data-tier="strong"], [data-tier="ready"], [data-tier="complete"]) .hs-card-body {
  border: 1px solid var(--hs-ivory-edge);
  background: var(--hs-ivory);
  color: var(--hs-ink);
  opacity: 1;
  filter: none;
  transform: translateY(-2px);
  box-shadow:
    0 3px 0 var(--hs-ivory-edge),
    0 8px 16px rgba(5, 16, 11, 0.34);
}

.hs-card:is([data-tier="strong"], [data-tier="ready"], [data-tier="complete"]) :is(.hs-card-progress) {
  color: var(--hs-ink-soft);
}

.hs-card:is([data-tier="strong"], [data-tier="ready"], [data-tier="complete"]) .hs-card-bonus {
  color: var(--hs-gold-deep);
}

.hs-card:is([data-tier="strong"], [data-tier="ready"], [data-tier="complete"]) .hs-pip {
  background: rgba(31, 58, 46, 0.14);
}

.hs-card:is([data-tier="strong"], [data-tier="ready"], [data-tier="complete"]) .hs-pip.is-on {
  background: #377159;
}

.hs-card[data-tier="ready"] .hs-card-body {
  border-color: var(--hs-gold);
  box-shadow:
    0 3px 0 #c9a44c,
    0 0 0 1px rgba(226, 191, 99, 0.6),
    0 8px 20px rgba(226, 191, 99, 0.22);
}

.hs-card[data-tier="ready"] .hs-pip.is-on {
  background: #c9a44c;
}

.hs-card[data-tier="complete"] .hs-card-body,
.hs-card.is-resolved .hs-card-body {
  border-color: #c9a44c;
  background: #f1d886;
  color: var(--hs-ink);
  box-shadow:
    0 3px 0 #b48c35,
    0 0 0 1px rgba(255, 226, 122, 0.7),
    0 10px 24px rgba(226, 191, 99, 0.3);
}

.hs-card[data-tier="complete"] .hs-card-bonus,
.hs-card.is-resolved .hs-card-bonus {
  color: var(--hs-ink);
}

.hs-card[data-tier="complete"] .hs-pip.is-on,
.hs-card.is-resolved .hs-pip.is-on {
  background: var(--hs-ink);
}

.hs-card.is-resolved .hs-card-check {
  opacity: 1;
  transform: none;
}

.hs-card.is-resolved .hs-card-bonus {
  margin-right: 1.3rem;
}

.hs-card.is-won:not(.is-resolved) .hs-card-body {
  animation: none;
}

.hs-card.is-surge .hs-card-body {
  animation: hs-surge 0.82s cubic-bezier(0.22, 0.8, 0.24, 1);
}

.hs-card.is-surge .hs-card-body::after,
.hs-card.is-stamp .hs-card-body::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 34%;
  background: rgba(255, 252, 238, 0.42);
  transform: translateX(-120%) skewX(-16deg);
  animation: hs-sheen 0.8s ease-out forwards;
  pointer-events: none;
}

.hs-card.is-stamp .hs-card-body {
  animation: hs-stamp 0.5s cubic-bezier(0.3, 1.5, 0.5, 1);
}

@media (hover: hover) and (pointer: fine) {
  .hs-card-body:hover {
    opacity: calc(0.62 + 0.38 * var(--c));
  }

  .hs-card:is([data-tier="strong"], [data-tier="ready"], [data-tier="complete"]) .hs-card-body:hover {
    transform: translateY(-4px);
  }
}

/* Narrower cards stack the name under the multiplier. */

@container (max-width: 11.5rem) {
  .hs-card-body {
    grid-template-areas:
      "bonus away"
      "name name"
      "pips pips";
    gap: 0.24rem 0.3rem;
  }

  .hs-card-name {
    font-size: 0.6rem;
    letter-spacing: 0.05em;
  }

  .hs-card-progress {
    display: none;
  }

  .hs-card-away {
    align-self: center;
    font-size: 0.58rem;
  }
}

@container (max-width: 8.5rem) {
  .hs-card-body {
    grid-template-areas:
      "bonus suit"
      "name name"
      "pips pips";
    gap: 0.2rem 0.3rem;
    padding: 0.3rem 0.4rem 0.36rem;
    border-radius: 0.5rem;
  }

  .hs-card-name {
    display: -webkit-box;
    font-size: 0.54rem;
    letter-spacing: 0.04em;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .hs-card-bonus {
    font-size: 0.78rem;
  }

  .hs-card-suit {
    grid-area: suit;
    display: block;
    justify-self: end;
    align-self: center;
    font-size: 0.54rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.8;
  }

  .hs-card-suit[hidden],
  .hs-card.is-resolved .hs-card-suit {
    display: none;
  }

  .hs-card-away {
    display: none;
  }

  .hs-pips {
    height: 0.24rem;
  }

  .hs-card-check {
    top: 0.26rem;
    right: 0.3rem;
    width: 0.95rem;
    height: 0.95rem;
    font-size: 0.58rem;
  }
}

/* Hands button */

.hs-open {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.28rem;
  min-width: 3rem;
  height: var(--hs-card-h);
  margin: 0 0 0 var(--hs-gap);
  padding: 0 0.5rem;
  border: 1px solid rgba(244, 236, 214, 0.18);
  border-radius: 0.62rem;
  background: rgba(12, 22, 18, 0.5);
  color: rgba(244, 236, 214, 0.86);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.hs-open:hover,
.hs-open:focus-visible {
  border-color: rgba(226, 191, 99, 0.6);
  background: rgba(12, 22, 18, 0.72);
}

.hs-open:focus-visible {
  outline: 2px solid var(--hs-gold);
  outline-offset: 2px;
}

.hs-open-icon {
  position: relative;
  width: 1.05rem;
  height: 1.3rem;
}

.hs-open-icon::before,
.hs-open-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid currentColor;
  border-radius: 0.2rem;
}

.hs-open-icon::before {
  opacity: 0.5;
  transform: translate(-3px, 2px) rotate(-9deg);
}

.hs-open-icon::after {
  background: rgba(12, 22, 18, 0.9);
  transform: translate(2px, -1px) rotate(6deg);
}

.hs-open-label {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Placement around the table */

@media (min-width: 1408px) {
  .table-frame.has-seeker {
    --south-y: clamp(4.9rem, 8.6vmin, 5.6rem);
    grid-template-rows: var(--top-chrome) auto var(--south-y);
  }

  .table-frame.has-seeker .table {
    width: min(
      calc(100cqw - (2 * var(--id-x))),
      calc(100cqh - var(--top-chrome) - var(--south-y) - var(--shadow-room))
    );
  }

  .table-frame.has-seeker .player-id[data-seat="south"] {
    grid-area: auto;
    grid-column: 1;
    grid-row: 3;
    justify-self: end;
    align-self: center;
    margin: 0.55rem 0.5rem 0 0;
  }

  .table-frame.has-seeker .hand-seeker {
    grid-column: 2 / 4;
    grid-row: 3;
    grid-template-columns: subgrid;
    align-self: center;
    margin-top: 0.55rem;
  }
}

@media (max-width: 1407px) {
  .hand-seeker {
    --hs-card-h: 3.75rem;
    --hs-gap: 0.4rem;
  }

  .table-frame.has-seeker .player-id[data-seat="south"] {
    justify-self: start;
  }

  .table-frame.has-seeker .hand-seeker {
    grid-area: id-south;
    justify-self: stretch;
    align-self: center;
    margin-left: 6.4rem;
    padding-right: var(--play-bar-pad-x, 1rem);
  }

  .hs-card-body {
    padding: 0.36rem 0.5rem 0.4rem;
  }
}

@media (max-width: 900px) {
  .hand-seeker {
    --hs-card-h: 3.55rem;
    --hs-gap: 0.3rem;
  }

  .table-frame.has-seeker .player-id[data-seat="south"] {
    padding-left: 0.7rem;
    padding-right: 0.4rem;
  }

  .table-frame.has-seeker .player-id[data-seat="south"] .player-id-copy {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .table-frame.has-seeker .hand-seeker {
    margin-left: 2.9rem;
    padding-right: 0.6rem;
  }

  .hs-open {
    min-width: 2.3rem;
    padding: 0 0.3rem;
  }

  .hs-open-label {
    font-size: 0.5rem;
    letter-spacing: 0.04em;
  }

  .hs-note {
    font-size: 0.66rem;
    text-align: center;
  }
}

/* Scoring reveal: each bonus row resolves like a Hand Card. */

.winning-score-bonus-check {
  display: inline-grid;
  place-items: center;
  width: 0.95rem;
  height: 0.95rem;
  margin-right: 0.32rem;
  border-radius: 50%;
  background: #f1d886;
  color: #1f3a2e;
  font-size: 0.58rem;
  font-weight: 900;
  vertical-align: 0.06em;
}

.winning-score-bonus.is-in .winning-score-bonus-check {
  animation: hs-check-in 0.36s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.winning-score-bonus-mult {
  margin-right: 0.42rem;
  color: rgba(245, 222, 154, 0.78);
  font-size: 0.64rem;
  font-weight: 800;
}

@keyframes hs-check-in {
  from {
    transform: scale(0.2) rotate(-25deg);
    opacity: 0;
  }
}

/* Hands reference */

.hs-sheet {
  --hs-ivory: #f4ecd6;
  --hs-ink: #1f3a2e;
  --hs-gold: #e2bf63;
  --hs-gold-deep: #9a7426;
  width: min(46rem, calc(100vw - 2rem));
  max-width: none;
  max-height: min(88vh, 54rem);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(244, 236, 214, 0.14);
  border-radius: 1rem;
  background: #141d18;
  color: rgba(244, 240, 228, 0.94);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  font-family: "Google Sans Flex", Inter, system-ui, sans-serif;
}

.hs-sheet::backdrop {
  background: rgba(5, 10, 8, 0.62);
}

.hs-sheet[open] {
  animation: hs-sheet-in 0.26s cubic-bezier(0.22, 0.8, 0.24, 1);
}

.hs-sheet-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: inherit;
}

.hs-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid rgba(244, 236, 214, 0.1);
}

.hs-sheet-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.hs-sheet-lede {
  max-width: 34rem;
  margin: 0.35rem 0 0;
  color: rgba(232, 238, 230, 0.66);
  font-size: 0.8rem;
  font-weight: 550;
  line-height: 1.45;
}

.hs-sheet-close {
  flex: none;
  min-height: 2rem;
  padding: 0.2rem 0.85rem;
  border: 1px solid rgba(244, 236, 214, 0.22);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.hs-sheet-close:focus-visible {
  outline: 2px solid var(--hs-gold);
  outline-offset: 2px;
}

.hs-ref-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 1rem 1.25rem 1.35rem;
  overflow-y: auto;
  list-style: none;
  overscroll-behavior: contain;
}

.hs-ref {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.4rem;
  padding: 0.85rem 0.9rem 0.9rem;
  border: 1px solid #cbbd98;
  border-radius: 0.8rem;
  background: var(--hs-ivory);
  color: var(--hs-ink);
  box-shadow: 0 3px 0 #cbbd98;
  scroll-margin: 1rem;
}

.hs-ref.is-focus {
  border-color: var(--hs-gold);
  box-shadow:
    0 3px 0 #c9a44c,
    0 0 0 2px rgba(226, 191, 99, 0.75);
}

.hs-ref-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.hs-ref-name {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.hs-ref-bonus {
  display: grid;
  justify-items: end;
  margin: 0;
}

.hs-ref-mult {
  color: var(--hs-gold-deep);
  font-size: 1.15rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hs-ref-points {
  color: rgba(31, 58, 46, 0.6);
  font-size: 0.62rem;
  font-weight: 700;
}

.hs-ref-summary,
.hs-ref-detail,
.hs-ref-tag,
.hs-ref-live {
  margin: 0;
}

.hs-ref-summary {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
}

.hs-ref-detail {
  color: rgba(31, 58, 46, 0.72);
  font-size: 0.76rem;
  font-weight: 550;
  line-height: 1.4;
}

.hs-ref-example {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.42rem;
  margin-top: 0.2rem;
}

.hs-ref-group {
  display: inline-flex;
  gap: 1px;
}

.hs-tile {
  display: block;
  width: 1.1rem;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.hs-ref-tag {
  justify-self: start;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: rgba(31, 58, 46, 0.08);
  color: rgba(31, 58, 46, 0.72);
  font-size: 0.64rem;
  font-weight: 750;
}

.hs-ref-live {
  order: -1;
  justify-self: start;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: #377159;
  color: #f4ecd6;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.hs-ref-live:is([data-tier="ready"], [data-tier="complete"]) {
  background: #c9a44c;
  color: var(--hs-ink);
}

.hs-ref-empty {
  grid-column: 1 / -1;
  color: rgba(232, 238, 230, 0.6);
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .hs-sheet {
    width: 100vw;
    max-height: 86vh;
    margin: auto 0 0;
    border-radius: 1rem 1rem 0 0;
    border-bottom: 0;
  }

  .hs-sheet[open] {
    animation-name: hs-sheet-up;
  }

  .hs-sheet-head {
    padding: 0.95rem 1rem 0.75rem;
  }

  .hs-ref-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem;
    padding: 0.8rem 1rem max(1.2rem, env(safe-area-inset-bottom));
  }

  .hs-tile {
    width: 1.18rem;
  }

  .hs-sheet-lede {
    font-size: 0.74rem;
  }
}

@keyframes hs-surge {
  0% {
    transform: translateY(0) scale(1);
  }
  35% {
    transform: translateY(-5px) scale(1.06);
  }
  100% {
    transform: translateY(-2px) scale(1);
  }
}

@keyframes hs-sheen {
  to {
    transform: translateX(320%) skewX(-16deg);
  }
}

@keyframes hs-stamp {
  0% {
    transform: scale(1);
  }
  40% {
    transform: translateY(-4px) scale(1.08);
  }
  100% {
    transform: translateY(-2px) scale(1);
  }
}

@keyframes hs-ready {
  0%,
  100% {
    box-shadow:
      0 3px 0 #c9a44c,
      0 0 0 1px rgba(226, 191, 99, 0.6),
      0 8px 20px rgba(226, 191, 99, 0.16);
  }
  50% {
    box-shadow:
      0 3px 0 #c9a44c,
      0 0 0 2px rgba(226, 191, 99, 0.85),
      0 8px 26px rgba(226, 191, 99, 0.34);
  }
}

@keyframes hs-leave {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
  }
}

@keyframes hs-sheet-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@keyframes hs-sheet-up {
  from {
    transform: translateY(30%);
    opacity: 0.6;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hs-card,
  .hs-card-body,
  .hs-card-check,
  .hs-pip {
    transition: none;
  }

  .hs-card[data-tier="ready"] .hs-card-body,
  .winning-score-bonus.is-in .winning-score-bonus-check,
  .hs-card.is-surge .hs-card-body,
  .hs-card.is-stamp .hs-card-body,
  .hs-sheet[open] {
    animation: none;
  }
}

/* ------------------------------------------------------------------ juice
   Hand Cards read like collectible game cards. The Mult is a red chip (a ×Mult
   Hand burns hotter), strong cards are ivory stock with an inner gold rule, a
   ready card carries a moving foil sheen, and a complete card is gold foil with
   a stamped check. The scoring reveal uses the same blue Chips and red Mult. */

.hand-seeker {
  --hs-red: #e54034;
  --hs-red-deep: #9a2a22;
  --hs-blue: #267aec;
}

.hs-card-bonus {
  justify-self: end;
  padding: 0.16rem 0.42rem 0.18rem;
  border-radius: 0.4rem;
  background: rgba(154, 42, 34, calc(0.25 + 0.55 * var(--c)));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.hs-card[data-effect="times"] .hs-card-bonus {
  background: var(--hs-red);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 0 calc(4px + 10px * var(--c)) rgba(229, 64, 52, 0.55);
}

.hs-card:is([data-tier="strong"], [data-tier="ready"], [data-tier="complete"]) .hs-card-bonus,
.hs-card[data-tier="complete"] .hs-card-bonus,
.hs-card.is-resolved .hs-card-bonus {
  color: #fff;
  background: var(--hs-red-deep);
}

.hs-card:is([data-tier="strong"], [data-tier="ready"], [data-tier="complete"])[data-effect="times"] .hs-card-bonus {
  background: var(--hs-red);
}

.hs-card:is([data-tier="strong"], [data-tier="ready"], [data-tier="complete"]) .hs-card-body::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(201, 164, 76, 0.55);
  border-radius: 0.46rem;
  pointer-events: none;
}

.hs-pips {
  height: 0.38rem;
  gap: 3px;
}

.hs-pip {
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.18);
}

.hs-card:is([data-tier="strong"], [data-tier="ready"]) .hs-pip.is-on {
  background: linear-gradient(180deg, #4f9a78, #2f6e53);
  box-shadow: 0 0 6px rgba(79, 154, 120, 0.55);
}

.hs-card[data-tier="ready"] .hs-pip.is-on {
  background: linear-gradient(180deg, #ffd56b, #c9a44c);
  box-shadow: 0 0 8px rgba(255, 213, 107, 0.7);
}

/* Ready: one tile away. A foil sheen sweeps the card every few seconds. */

.hs-card[data-tier="ready"] .hs-card-body {
  background:
    linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.55) 45%, rgba(255, 233, 160, 0.45) 50%, transparent 62%) -160% 0 / 250% 100% no-repeat,
    var(--hs-ivory);
  /* The sweeping foil is the ready card's motion; a breathing box-shadow repainted it every frame. */
  animation: hs-foil 3.2s ease-in-out infinite;
}

.hs-card[data-tier="ready"] .hs-card-away {
  color: #9a2a22;
}

/* Complete: gold foil, a stamped check, and a few sparks. */

.hs-card[data-tier="complete"] .hs-card-body,
.hs-card.is-resolved .hs-card-body {
  background:
    linear-gradient(115deg, transparent 25%, rgba(255, 255, 255, 0.5) 42%, transparent 55%) -160% 0 / 250% 100% no-repeat,
    linear-gradient(160deg, #ffe7a0, #f1d886 40%, #d9b04a);
}

.hs-card.is-resolved .hs-card-body {
  animation: hs-foil 2.6s ease-in-out infinite;
}

.hs-card.is-resolved .hs-card-check,
.hs-card[data-tier="complete"] .hs-card-check {
  background: var(--hs-red);
  color: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.hs-card.is-stamp .hs-card-body {
  animation: hs-stamp-big 0.56s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.hs-card.is-stamp::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 1rem;
  background:
    radial-gradient(circle at 12% 30%, #ffe08a 0 3px, transparent 4px),
    radial-gradient(circle at 88% 20%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 80% 85%, #ffe08a 0 3px, transparent 4px),
    radial-gradient(circle at 20% 90%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 50% 0%, #ffd56b 0 2px, transparent 3px);
  pointer-events: none;
  animation: hs-sparks 0.7s ease-out forwards;
}

/* The Hands button reads as a deck. */

.hs-open {
  background: linear-gradient(180deg, rgba(31, 58, 46, 0.9), rgba(12, 22, 18, 0.9));
  border-color: rgba(226, 191, 99, 0.42);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.hs-open:hover,
.hs-open:focus-visible {
  transform: translateY(-2px);
}

.hs-open-icon::after {
  background: linear-gradient(160deg, #f4ecd6, #e2d3a8);
  border-color: #c9a44c;
}

/* The Hands reference: the same cards, bigger, with the Mult as a chip. */

.hs-sheet {
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(44, 122, 96, 0.55), transparent 70%),
    #101914;
}

.hs-sheet-title {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.hs-ref {
  border: 1px solid #c9b58a;
  background: linear-gradient(170deg, #fbf5e4, var(--hs-ivory));
  box-shadow: 0 4px 0 #c2b085, 0 14px 28px rgba(0, 0, 0, 0.32);
  transition: transform 0.25s cubic-bezier(0.22, 0.8, 0.24, 1), box-shadow 0.25s ease;
}

.hs-ref::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(201, 164, 76, 0.5);
  border-radius: 0.6rem;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .hs-ref:hover {
    transform: translateY(-3px) rotate(-0.4deg);
    box-shadow: 0 6px 0 #c2b085, 0 20px 36px rgba(0, 0, 0, 0.38);
  }
}

.hs-ref-mult {
  padding: 0.22rem 0.55rem 0.26rem;
  border-radius: 0.5rem;
  background: #9a2a22;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}

.hs-ref[data-effect="times"] .hs-ref-mult {
  background: #e54034;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3), 0 0 16px rgba(229, 64, 52, 0.5);
  transform: rotate(-3deg);
}

.hs-ref-points {
  margin-top: 0.3rem;
  color: #267aec;
  font-weight: 850;
}

.hs-ref-example .hs-tile {
  width: 1.35rem;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

.hs-ref:has(.hs-ref-live[data-tier="ready"]) {
  border-color: #e2bf63;
  box-shadow: 0 4px 0 #c9a44c, 0 0 0 2px rgba(226, 191, 99, 0.6), 0 14px 28px rgba(0, 0, 0, 0.32);
}

.hs-ref:has(.hs-ref-live[data-tier="complete"]) {
  background: linear-gradient(160deg, #ffe7a0, #f1d886 45%, #e2c068);
}

@keyframes hs-foil {
  0%,
  55% {
    background-position: -160% 0, 0 0;
  }
  100% {
    background-position: 260% 0, 0 0;
  }
}

@keyframes hs-stamp-big {
  0% {
    transform: scale(1.18) rotate(-3deg);
  }
  55% {
    transform: scale(0.95) rotate(1deg);
  }
}

@keyframes hs-sparks {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  30% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: scale(1.25);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hs-card[data-tier="ready"] .hs-card-body,
  .hs-card.is-resolved .hs-card-body,
  .hs-card.is-stamp .hs-card-body,
  .hs-card.is-stamp::after,
  .hs-ref {
    animation: none;
    transition: none;
  }
}


/* ------------------------------------------------------------ Card Drops
   This month's drop boosts some Hands. A boosted Hand Card wears a gold
   ribbon; the Hands reference opens with the drop's official card art. */

.hs-card.is-boosted::before {
  content: "▲ Boosted";
  position: absolute;
  z-index: 3;
  top: -0.55rem;
  left: 0.5rem;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe08a, #e0b042);
  color: #3d2a08;
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.hs-card.is-boosted .hs-card-bonus {
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 0 0 2px #ffe08a, 0 0 12px rgba(255, 224, 138, 0.7);
}

.hs-drop {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0 0.8rem;
  text-align: center;
}

.hs-drop-kicker {
  margin: 0;
  color: #f4c654;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hs-drop-name {
  margin: 0;
  color: #fff6d4;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.hs-drop-cards {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin: 0.6rem 0 0.2rem;
}

.hs-drop-card {
  margin: 0;
  cursor: pointer;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.25s cubic-bezier(0.22, 0.8, 0.24, 1);
  animation: hs-drop-in 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}

.hs-drop-card:nth-child(2) {
  animation-delay: 0.12s;
}

.hs-drop-card:hover {
  transform: rotate(0deg) translateY(-6px) scale(1.03);
}

.hs-drop-card img {
  display: block;
  width: min(11rem, 36vw);
  height: auto;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.5));
}

.hs-drop-card figcaption {
  margin-top: 0.4rem;
  color: rgba(244, 240, 228, 0.86);
  font-size: 0.74rem;
  font-weight: 750;
}

.hs-drop-note {
  max-width: 30rem;
  margin: 0.2rem 0 0;
  color: rgba(232, 238, 230, 0.66);
  font-size: 0.74rem;
  line-height: 1.4;
}

.hs-ref.is-boosted {
  box-shadow: 0 4px 0 #c9a44c, 0 0 0 2px rgba(255, 224, 138, 0.8), 0 14px 28px rgba(0, 0, 0, 0.32);
}

.hs-ref-boost {
  justify-self: start;
  margin: 0;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: #1f2822;
  color: #ffe08a;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}

@keyframes hs-drop-in {
  from {
    opacity: 0;
    transform: translateY(24px) rotate(calc(var(--tilt, 0deg) * -2)) scale(0.85);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hs-drop-card {
    animation: none;
    transition: none;
  }
}

/* -------------------------------------------------------- learn by doing
   Fewer words. A card is its name, its Mult chip, its pips, and a count of
   tiles to go. Tap or hover a card and the tiles building it light up on
   your Rack; when a move pushes a Hand forward, the Rack shows you why. */

.hs-card-body {
  grid-template-areas:
    "name bonus"
    "pips away";
  align-content: space-between;
}

.hs-card-progress:empty {
  display: none;
}

.hs-card-away {
  grid-area: away;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.3rem;
  border-radius: 0.32rem;
  background: rgba(244, 236, 214, 0.14);
  color: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.hs-card-away::after {
  content: "";
  display: inline-block;
  width: 0.42rem;
  height: 0.56rem;
  margin-left: 0.18rem;
  border-radius: 0.1rem;
  background: currentColor;
  opacity: 0.55;
}

.hs-card[data-away="0"] .hs-card-away::after {
  display: none;
}

.hs-card:is([data-tier="strong"], [data-tier="ready"], [data-tier="complete"]) .hs-card-away {
  background: rgba(31, 58, 46, 0.12);
}

.hs-card[data-tier="ready"] .hs-card-away {
  background: #e54034;
  color: #fff;
}

.hs-card.is-showing .hs-card-body {
  outline: 2px solid #ffe08a;
  outline-offset: 2px;
  transform: translateY(-4px);
}

/* The Hands reference opens on the rule as a picture: Chips × Mult = Score. */

.hs-formula {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.hs-formula-box {
  display: inline-grid;
  justify-items: end;
  min-width: 3.6rem;
  padding: 0.22rem 0.55rem;
  border-radius: 0.5rem;
  color: #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}

.hs-formula-box small {
  justify-self: start;
  font-size: 0.5rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  opacity: 0.85;
  text-transform: uppercase;
}

.hs-formula-box b {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
}

.hs-formula-box--chips {
  background: #267aec;
}

.hs-formula-box--mult {
  background: #e54034;
}

.hs-formula-box--score {
  background: linear-gradient(180deg, #f8d779, #d9a93a);
  color: #3d2a08;
}

.hs-formula-op {
  color: #fff6d4;
  font-size: 1.2rem;
  font-weight: 900;
}

.hs-formula-note {
  flex-basis: 100%;
  color: rgba(232, 238, 230, 0.66);
  font-size: 0.76rem;
}

.hs-ref-detail {
  display: none;
}

.hs-ref-example .hs-tile {
  width: 1.6rem;
}

.hs-ref-live {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 8rem;
}

.hs-ref-live .hs-pips {
  flex: 1 1 auto;
  height: 0.38rem;
}

.hs-ref-live .hs-pip {
  background: rgba(244, 236, 214, 0.3);
}

.hs-ref-live .hs-pip.is-on {
  background: #ffe08a;
}

.hs-ref-away {
  font-weight: 900;
}

/* Less text: the old Mult sits struck through beside a boosted Hand's new one. */
.hs-ref-bonus {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hs-ref-was {
  color: rgba(31, 58, 46, 0.5);
  font-size: 0.95rem;
  font-weight: 800;
  text-decoration-thickness: 2px;
}

/* ===================================================================== */
/* Hand Cards, round three: a little collectible per Hand.                 */
/* The picture (real tiles) says what it is; the Mult pill says what it's  */
/* worth; the bar and coin say how close you are. The name is a caption.   */

.hand-seeker .hs-card .hs-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "glyph bonus"
    "name  name"
    "pips  away";
  align-items: center;
  gap: 0.3rem 0.45rem;
  min-height: 5.6rem;
  padding: 0.55rem 0.6rem 0.5rem;
  border-radius: 0.85rem;
  opacity: 1;
  text-align: left;
}

.hand-seeker .hs-card .hs-card-head,
.hand-seeker .hs-card .hs-card-foot {
  display: contents;
}

.hand-seeker .hs-card .hs-card-suit,
.hand-seeker .hs-card .hs-card-progress {
  display: none;
}

.hand-seeker .hs-glyph {
  grid-area: glyph;
  display: flex;
  align-items: flex-end;
  min-height: 1.7rem;
}

.hand-seeker .hs-glyph-tile {
  display: block;
  width: 1.15rem;
  height: auto;
  margin-right: -0.18rem;
  border-radius: 0.18rem;
  filter: drop-shadow(0 1.5px 0 rgba(0, 0, 0, 0.3));
  transform: rotate(var(--t, 0deg));
}

.hand-seeker .hs-glyph-tile:nth-child(1) { --t: -6deg; }
.hand-seeker .hs-glyph-tile:nth-child(2) { --t: 0deg; transform: translateY(-2px); }
.hand-seeker .hs-glyph-tile:nth-child(3) { --t: 6deg; }

.hand-seeker .hs-card .hs-card-bonus {
  grid-area: bonus;
  justify-self: end;
  padding: 0.18rem 0.45rem 0.22rem;
  border-radius: 0.5rem;
  background: linear-gradient(180deg, #e0573f, #b63a27);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 0 #7d2416;
}

.hand-seeker .hs-card[data-effect="times"] .hs-card-bonus {
  background: linear-gradient(180deg, #ff6a45, #d23a1f);
  box-shadow: 0 2px 0 #8a1f0c, 0 0 12px rgba(255, 106, 69, 0.45);
}

.hand-seeker .hs-card .hs-card-name {
  grid-area: name;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  line-height: 1.15;
  text-transform: uppercase;
  white-space: normal;
  text-overflow: clip;
}

.hand-seeker .hs-card .hs-pips {
  grid-area: pips;
  display: flex;
  gap: 2px;
  height: 0.42rem;
  margin: 0;
}

.hand-seeker .hs-card .hs-pip {
  flex: 1 1 0;
  height: 100%;
  border-radius: 999px;
}

.hand-seeker .hs-card .hs-card-away {
  grid-area: away;
  display: inline-grid;
  place-items: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.hand-seeker .hs-card .hs-card-away::after {
  content: none;
}

.hand-seeker .hs-card .hs-card-check {
  display: none;
}

/* Possible: readable glass, not disabled. The bar and coin show how far off it is. */
.hand-seeker .hs-card[data-tier="possible"] .hs-card-body,
.hand-seeker .hs-card[data-tier="speculative"] .hs-card-body {
  border: 1px solid rgba(244, 236, 214, 0.18);
  background: linear-gradient(180deg, rgba(244, 236, 214, 0.1), rgba(244, 236, 214, 0.04));
  color: rgba(244, 236, 214, 0.86);
}

.hand-seeker .hs-card[data-tier="speculative"] .hs-card-body {
  border-style: dashed;
}

.hand-seeker .hs-card[data-tier="possible"] .hs-pip,
.hand-seeker .hs-card[data-tier="speculative"] .hs-pip {
  background: rgba(244, 236, 214, 0.14);
}

.hand-seeker .hs-card[data-tier="possible"] .hs-pip.is-on,
.hand-seeker .hs-card[data-tier="speculative"] .hs-pip.is-on {
  background: rgba(244, 236, 214, 0.7);
}

/* Strong and ready: an ivory card, green progress. Ready glows gold and its coin turns green. */
.hand-seeker .hs-card:is([data-tier="strong"], [data-tier="ready"]) .hs-card-body {
  border: 1px solid #cbbd98;
  background: linear-gradient(180deg, #fbf5e2, #efe4c6);
  color: #1f3a2e;
  box-shadow: 0 3px 0 #b5a57c;
}

.hand-seeker .hs-card:is([data-tier="strong"], [data-tier="ready"]) .hs-pip {
  background: rgba(31, 58, 46, 0.14);
}

.hand-seeker .hs-card:is([data-tier="strong"], [data-tier="ready"]) .hs-pip.is-on {
  background: linear-gradient(180deg, #4fb36c, #2f8a50);
}

.hand-seeker .hs-card:is([data-tier="strong"], [data-tier="ready"]) .hs-card-away {
  background: rgba(31, 58, 46, 0.12);
}

.hand-seeker .hs-card[data-tier="ready"] .hs-card-body {
  border-color: #e2bf63;
  box-shadow: 0 3px 0 #b88f2e, 0 0 0 2px rgba(226, 191, 99, 0.5), 0 0 18px rgba(226, 191, 99, 0.45);
}

.hand-seeker .hs-card[data-tier="ready"] .hs-card-away {
  background: linear-gradient(180deg, #4fb36c, #2f8a50);
  color: #fff;
  box-shadow: 0 2px 0 #1d5432;
}

/* Made: a gold card with a check coin. */
.hand-seeker .hs-card:is([data-tier="complete"], .is-resolved) .hs-card-body {
  border: 1px solid #b88f2e;
  background: linear-gradient(180deg, #f6d77c, #d6a83f);
  color: #3d2a08;
  box-shadow: 0 3px 0 #8f6a17, 0 0 16px rgba(246, 215, 124, 0.45);
}

.hand-seeker .hs-card:is([data-tier="complete"], .is-resolved) .hs-pip,
.hand-seeker .hs-card:is([data-tier="complete"], .is-resolved) .hs-pip.is-on {
  background: rgba(61, 42, 8, 0.45);
}

.hand-seeker .hs-card:is([data-tier="complete"], .is-resolved) .hs-card-away {
  background: #fff6d8;
  color: #2f7a4a;
}

/* Showing its tiles on the Rack: lifted with a gold ring. */
.hand-seeker .hs-card.is-showing .hs-card-body {
  transform: translateY(-3px);
  box-shadow: 0 0 0 2px #f1c75b, 0 10px 22px rgba(0, 0, 0, 0.35);
}

/* Narrow cards, wherever they are: picture and coin, then the Mult, then the bar.
   The name lives in the card's label. Sized by the card itself, not the screen. */
.hand-seeker .hs-card {
  container-type: inline-size;
}

@container (max-width: 170px) {
  .hand-seeker .hs-card .hs-card-body {
    grid-template-areas:
      "glyph away"
      "bonus bonus"
      "pips  pips";
    min-height: 4.9rem;
    gap: 0.22rem 0.3rem;
    padding: 0.45rem 0.45rem 0.4rem;
    border-radius: 0.7rem;
  }

  .hand-seeker .hs-glyph-tile {
    width: 0.95rem;
  }

  .hand-seeker .hs-card .hs-card-bonus {
    padding: 0.14rem 0.32rem 0.18rem;
    font-size: 0.7rem;
  }

  .hand-seeker .hs-card .hs-card-name {
    display: none;
  }

  .hand-seeker .hs-card .hs-card-bonus {
    justify-self: stretch;
    text-align: center;
  }

  .hand-seeker .hs-card .hs-card-away {
    min-width: 1.2rem;
    height: 1.2rem;
    font-size: 0.66rem;
  }
}

/* The cards tilt toward a cursor and spring when touched. */
.hand-seeker .hs-card .hs-card-body {
  transition: transform 260ms cubic-bezier(0.3, 1.6, 0.5, 1), box-shadow 200ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .hand-seeker .hs-card:hover .hs-card-body {
    transform: translateY(-3px) rotate(-1.2deg);
  }
}

.hand-seeker .hs-card .hs-card-body:active {
  transform: scale(0.95);
  transition-duration: 80ms;
}

/* A card that just moved closer jiggles, like a Balatro joker scoring. */
.hand-seeker .hs-card.is-surge .hs-card-body {
  animation: hs-jiggle 520ms cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes hs-jiggle {
  0% { transform: none; }
  20% { transform: scale(1.1) rotate(-4deg); }
  40% { transform: scale(0.98) rotate(3deg); }
  60% { transform: scale(1.03) rotate(-1.5deg); }
  100% { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hand-seeker .hs-card .hs-card-body {
    transition: none;
    animation: none;
  }
}

/* The month's Card Drop wears the month: its colors and its backdrop (drop.theme, drop.backdrop). */
.hs-drop.is-themed {
  margin: 0.2rem 0 0.4rem;
  padding: 0.9rem 0.6rem 1rem;
  border-radius: 1rem;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--drop-deep) 30%, transparent), color-mix(in srgb, var(--drop-deep) 75%, transparent)),
    var(--drop-backdrop, none) center / cover,
    linear-gradient(180deg, var(--drop-primary), var(--drop-deep));
  box-shadow: 0 4px 0 color-mix(in srgb, var(--drop-deep) 80%, black), 0 14px 28px rgba(0, 0, 0, 0.3);
}

.hs-drop.is-themed .hs-drop-kicker {
  color: var(--drop-light);
  text-shadow: 0 2px 0 var(--drop-deep);
}

/* The Boosted ribbon in this month's drop color, when the game knows it. */
.hand-seeker .hs-card.is-boosted::before {
  background: linear-gradient(180deg, var(--drop-primary, #ffe08a), var(--drop-deep, #e0b042));
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

/* Tap a Hand Card: the Rack row says what that Hand is seeking, right above your tiles, until you tap it again. */
.rack-seek {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 1.7rem);
  z-index: 6;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.6rem;
  width: max-content;
  max-width: min(34rem, 94%);
  padding: 0.5rem 0.55rem 0.5rem 0.7rem;
  border: 2px solid #ffe08a;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #fbf4df, #efe2bd);
  box-shadow: 0 5px 0 rgba(60, 40, 6, 0.4), 0 14px 30px rgba(0, 0, 0, 0.35);
  color: #1f3a2e;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px) scale(0.96);
  transform-origin: 50% 100%;
  transition: opacity 0.16s ease, transform 0.26s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.rack-seek.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

/* A little tail pointing down at the tiles. */
.rack-seek::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 0.8rem;
  height: 0.8rem;
  border-right: 2px solid #ffe08a;
  border-bottom: 2px solid #ffe08a;
  background: #efe2bd;
  transform: translate(-50%, -55%) rotate(45deg);
}

.rack-seek .hs-glyph {
  display: inline-flex;
  align-items: flex-end;
}

.rack-seek .hs-glyph-tile {
  width: 1.45rem;
  margin-left: -0.3rem;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.22));
}

.rack-seek .hs-glyph-tile:first-child {
  margin-left: 0;
  transform: rotate(-6deg);
}

.rack-seek .hs-glyph-tile:nth-child(3) {
  transform: rotate(6deg);
}

.rack-seek-text {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.rack-seek-text p {
  margin: 0;
}

.rack-seek-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.4rem;
  font-size: 0.9rem;
  line-height: 1.1;
}

.rack-seek-kicker {
  color: #9a7426;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rack-seek-name {
  font-weight: 900;
}

.rack-seek-bonus {
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  background: #b8433a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
}

.rack-seek[data-effect="times"] .rack-seek-bonus {
  background: #e54034;
}

.rack-seek-want {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.rack-seek-tally {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.12rem !important;
}

.rack-seek-tally span {
  padding: 0.06rem 0.42rem;
  border-radius: 999px;
  background: rgba(31, 58, 46, 0.1);
  font-size: 0.68rem;
  font-weight: 850;
  white-space: nowrap;
}

.rack-seek-tally .rack-seek-fit {
  background: #ffe08a;
  color: #4a3406;
  box-shadow: inset 0 0 0 1px #d9a93a;
}

.rack-seek-card,
.rack-seek-close {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.rack-seek-card {
  padding: 0.42rem 0.65rem;
  border-radius: 0.6rem;
  background: #1f3a2e;
  box-shadow: 0 3px 0 #0e1f17;
  color: #fff6d4;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.rack-seek-card:active,
.rack-seek-close:active {
  transform: translateY(2px);
  box-shadow: none;
}

.rack-seek-close {
  align-self: start;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: rgba(31, 58, 46, 0.1);
  color: #1f3a2e;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

/* Hover previews have no buttons; a pinned Hand does. */
.rack-seek:not(.is-pinned) .rack-seek-card,
.rack-seek:not(.is-pinned) .rack-seek-close {
  display: none;
}

/* While you pick a discard, step the banner out of the way of the Discard button. */
.south-hand.has-selection .rack-seek.is-open {
  opacity: 0;
  pointer-events: none;
}

/* The fitting tiles: lifted, gold-ringed, with a check; the rest clearly step back. */
.rack-south.is-showing-hand .mj-tile:not(.is-hand-fit) .mj-tile-body {
  filter: saturate(0.35) brightness(0.6);
  opacity: 0.8;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.rack-south .mj-tile.is-hand-fit .mj-tile-body {
  transform: translateY(-14%);
  box-shadow: 0 0 0 3px #ffe08a, 0 10px 18px rgba(0, 0, 0, 0.3), 0 0 22px rgba(255, 224, 138, 0.8);
  transition: transform 0.24s cubic-bezier(0.3, 1.5, 0.5, 1), box-shadow 0.2s ease;
}

.rack-south .mj-tile.is-hand-fit {
  position: relative;
}

.rack-south .mj-tile.is-hand-fit::after {
  content: "✓";
  position: absolute;
  left: 50%;
  top: -14%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #2f8a4c;
  box-shadow: 0 0 0 2px #fff6d4;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  transform: translate(-50%, -60%);
  pointer-events: none;
  animation: rack-seek-check 0.28s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

.hs-card.is-pinned .hs-card-body {
  outline: 3px solid #ffe08a;
  outline-offset: 2px;
  transform: translateY(-6px);
  box-shadow: 0 0 22px rgba(255, 224, 138, 0.55);
}

@keyframes rack-seek-check {
  from { transform: translate(-50%, -20%) scale(0.2); opacity: 0; }
}

@media (max-width: 640px) {
  .rack-seek {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.4rem;
    bottom: calc(100% + 1.25rem);
    max-width: calc(100vw - 1.5rem);
    padding: 0.36rem 0.4rem 0.36rem 0.5rem;
    border-radius: 0.75rem;
  }

  /* The Hands button sits right below; on a phone the banner keeps to what this Hand wants. */
  .rack-seek-card {
    display: none;
  }

  .rack-seek-head {
    font-size: 0.76rem;
  }

  .rack-seek-kicker {
    font-size: 0.52rem;
  }

  .rack-seek-bonus {
    font-size: 0.6rem;
  }

  .rack-seek-want {
    font-size: 0.7rem;
  }

  .rack-seek-tally span {
    font-size: 0.58rem;
  }

  .rack-seek-close {
    width: 1.35rem;
    height: 1.35rem;
    font-size: 0.9rem;
  }

  .rack-seek .hs-glyph-tile {
    width: 1rem;
  }

  .rack-south .mj-tile.is-hand-fit::after {
    width: 0.85rem;
    height: 0.85rem;
    font-size: 0.5rem;
    transform: translate(-50%, -95%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rack-seek,
  .rack-seek.is-open {
    transition: none;
  }

  .rack-south .mj-tile.is-hand-fit::after {
    animation: none;
  }

  .rack-south .mj-tile.is-hand-fit .mj-tile-body {
    transform: none;
    transition: none;
  }
}

/* ------------------------------------------------------------ Island Card hands
   A card hand shows its line: one tile per group, its size as a small count,
   lit when your Rack holds the whole group and half lit when it holds part. */

.hand-seeker .hs-line {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  align-items: flex-end;
  justify-content: flex-start;
  width: 100%;
  min-height: 1.7rem;
  overflow: hidden;
}

/* On a phone's narrow card a long line fades out at the edge instead of being cut mid-tile. */
@container (max-width: 8.5rem) {
  .hand-seeker .hs-line {
    mask-image: linear-gradient(90deg, #000 calc(100% - 0.9rem), transparent);
  }
}

.hand-seeker .hs-line-group {
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  align-items: flex-end;
  opacity: 0.4;
  transition: opacity 180ms ease, transform 180ms ease;
}

.hand-seeker .hs-line-group[data-state="part"] {
  opacity: 0.72;
}

.hand-seeker .hs-line-group[data-state="full"] {
  opacity: 1;
  transform: translateY(-1px);
}

.hand-seeker .hs-line-group[data-exposed="true"] .hs-tile {
  outline: 2px solid rgba(255, 224, 138, 0.85);
  outline-offset: -1px;
  border-radius: 3px;
}

.hand-seeker .hs-line-group .hs-tile {
  display: block;
  flex: 0 1 auto;
  min-width: 0.66rem;
  width: 0.92rem;
  max-width: 100%;
  height: auto;
  border-radius: 0.14rem;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.3));
}

.hand-seeker .hs-line-count {
  flex: 0 0 auto;
  margin-left: 1px;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

.hs-card.is-bonus-hand::before {
  content: "★ Bonus Hand";
  white-space: nowrap;
  position: absolute;
  z-index: 3;
  top: -0.55rem;
  left: 0.5rem;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff9fbf, #d6336c);
  color: #fff;
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.hs-card.is-card-hand[data-concealed="true"] .hs-card-name::after {
  content: " · Concealed";
  opacity: 0.7;
  font-weight: 800;
}

/* Narrow tables keep the ribbon to one short word. */
@media (max-width: 900px) {
  .hs-card.is-bonus-hand::before {
    content: "★ Bonus";
    top: -0.5rem;
    left: 50%;
    translate: -50% 0;
  }
}

/* ------------------------------------------------------------ Island Card hands as cards
   A card hand is a little playing card at every tier: ivory paper with a faint grain, a printed
   gold frame, rounded corners, a lip and a drop shadow, and a slight fan across the strip like a
   hand of cards. How close you are shows in the pips, the count, and the ready/complete foils. */

.hand-seeker .hs-card.is-card-hand {
  rotate: var(--hs-fan, 0deg);
  transform-origin: 50% 120%;
  transition:
    rotate 0.3s cubic-bezier(0.22, 0.8, 0.24, 1),
    translate 0.46s cubic-bezier(0.22, 0.8, 0.24, 1),
    opacity 0.38s ease,
    transform 0.38s cubic-bezier(0.22, 0.8, 0.24, 1);
}

.hand-seeker .hs-card.is-card-hand:nth-child(1) { --hs-fan: -1.8deg; }
.hand-seeker .hs-card.is-card-hand:nth-child(2) { --hs-fan: 0.4deg; }
.hand-seeker .hs-card.is-card-hand:nth-child(3) { --hs-fan: 1.9deg; }
.hand-seeker .hs-card.is-card-hand:nth-child(4) { --hs-fan: -0.8deg; }

.hand-seeker .hs-card.is-card-hand:is(.is-showing, :hover) {
  rotate: 0deg;
}

.hand-seeker .hs-card.is-card-hand:not([data-tier="ready"]):not([data-tier="complete"]):not(.is-resolved) .hs-card-body {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.55), transparent 60%),
    repeating-linear-gradient(115deg, rgba(120, 96, 50, 0.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(25deg, rgba(120, 96, 50, 0.03) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #faf4e4, #efe4c7);
}

.hand-seeker .hs-card.is-card-hand .hs-card-body {
  border: 1px solid var(--hs-ivory-edge);
  border-radius: 0.7rem;
  color: var(--hs-ink);
  opacity: calc(0.82 + 0.18 * var(--c));
  filter: saturate(calc(0.7 + 0.3 * var(--c)));
  box-shadow:
    inset 0 0 0 3px rgba(250, 244, 228, 0.9),
    inset 0 0 0 4px rgba(201, 164, 76, 0.45),
    0 2px 0 var(--hs-ivory-edge),
    0 3px 0 rgba(120, 96, 50, 0.35),
    0 10px 18px rgba(5, 16, 11, 0.38);
}

.hand-seeker .hs-card.is-card-hand[data-tier="ready"] .hs-card-body {
  box-shadow:
    inset 0 0 0 3px rgba(250, 244, 228, 0.9),
    inset 0 0 0 4px rgba(226, 191, 99, 0.9),
    0 2px 0 #c9a44c,
    0 0 0 1px rgba(226, 191, 99, 0.6),
    0 10px 22px rgba(226, 191, 99, 0.28);
}

.hand-seeker .hs-card.is-card-hand .hs-card-name {
  color: var(--hs-ink);
}

.hand-seeker .hs-card.is-card-hand .hs-line-count {
  color: var(--hs-ink);
  text-shadow: none;
}

.hand-seeker .hs-card.is-card-hand .hs-pip {
  background: rgba(31, 58, 46, 0.14);
}

.hand-seeker .hs-card.is-card-hand .hs-card-away {
  background: rgba(31, 58, 46, 0.12);
}

.hand-seeker .hs-card.is-card-hand .hs-line-group[data-state="none"] {
  opacity: 0.5;
}

/* The objective's first line names the Island Card: the closest card hops and glows to show
   where that card lives, like a suggested tile. */
.hand-seeker .hs-card.is-intro {
  z-index: 4;
  rotate: 0deg;
}

.hand-seeker .hs-card.is-intro .hs-card-body {
  outline: 2px solid #ffe08a;
  outline-offset: 2px;
  animation: hs-intro-hop 0.85s ease-in-out infinite;
}

.hs-intro-tag {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  translate: -50% 0;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe08a, #e2bf63);
  color: #3b2a07;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 0 #b8902f;
  pointer-events: none;
  animation: hs-intro-tag-in 0.3s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

.hs-card.is-bonus-hand .hs-intro-tag {
  bottom: calc(100% + 1.05rem);
}

@keyframes hs-intro-hop {
  0%, 100% { translate: 0 0; }
  45% { translate: 0 -7px; }
  60% { translate: 0 -5px; }
}

@keyframes hs-intro-tag-in {
  from { opacity: 0; translate: -50% 6px; }
  to { opacity: 1; translate: -50% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hand-seeker .hs-card.is-intro .hs-card-body,
  .hs-intro-tag {
    animation: none;
  }
}

/* A card game's Hands sheet holds the printed Island Card (island_card.css). */

.hs-sheet.is-island-card {
  width: min(60rem, calc(100vw - 2rem));
}

.hs-sheet.is-island-card .hs-ref-list {
  grid-template-columns: minmax(0, 1fr);
  padding: 0.9rem 1rem 1.2rem;
}

.hs-ref-island {
  list-style: none;
}

@media (max-width: 640px) {
  .hs-sheet.is-island-card {
    width: 100vw;
  }

  .hs-sheet.is-island-card .hs-ref-list {
    padding: 0.6rem 0.6rem max(1rem, env(safe-area-inset-bottom));
  }
}

/* The card has its own masthead: the sheet keeps only Close, floating over the card's corner. */
.hs-sheet.is-island-card .hs-sheet-card {
  position: relative;
  grid-template-rows: minmax(0, 1fr);
}

.hs-sheet.is-island-card .hs-sheet-head {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  padding: 0;
  border: 0;
}

.hs-sheet.is-island-card .hs-sheet-titles {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.hs-sheet.is-island-card .hs-sheet-close {
  border-color: rgba(28, 43, 37, 0.2);
  background: rgba(252, 248, 238, 0.92);
  color: #1c2b25;
}

.hs-sheet.is-island-card {
  background: transparent;
  border: 0;
}

.hs-sheet.is-island-card .hs-ref-list {
  padding: 0;
}

.hs-sheet.is-island-card,
.hs-sheet.is-island-card .ic {
  border-radius: 8px;
}

@media (max-width: 640px) {
  .hs-sheet.is-island-card,
  .hs-sheet.is-island-card .ic {
    border-radius: 12px 12px 0 0;
  }
}
