/* The five print colors and their positions on the illustrated deck sheet. */
[data-color="red"]    { --print: #913826; --suit-light: #ff9b7d; --sheet-x: 0%;   --sheet-y: 0%; }
[data-color="yellow"] { --print: #825607; --suit-light: #f0cb73; --sheet-x: 50%;  --sheet-y: 0%; }
[data-color="green"]  { --print: #285c47; --suit-light: #8ccda5; --sheet-x: 100%; --sheet-y: 0%; }
[data-color="blue"]   { --print: #245873; --suit-light: #86c7e5; --sheet-x: 0%;   --sheet-y: 100%; }
[data-color="white"]  { --print: #46455c; --suit-light: #e2ded5; --sheet-x: 50%;  --sheet-y: 100%; }

.suit-mark {
  display: block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  fill: currentColor;
}

.hand, .fireworks {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(5px, 1vw, 13px);
  margin-inline: auto;
}
.hand {
  width: min(100%, 31rem);
  padding: 0;
  list-style: none;
}
.hand > li {
  position: relative;
  min-width: 0;
  text-align: center;
  --tilt: 0deg;
}
.hand > li:nth-child(1) { --tilt: -3deg; }
.hand > li:nth-child(2) { --tilt: -1.4deg; }
.hand > li:nth-child(4) { --tilt: 1.4deg; }
.hand > li:nth-child(5) { --tilt: 3deg; }
.hand .card {
  transform: rotate(var(--tilt));
  transform-origin: center 86%;
}
.card {
  display: block;
  position: relative;
  isolation: isolate;
  padding: 0;
  width: 100%;
  aspect-ratio: 0.72;
  border: 1px solid #fcf1d3;
  border-radius: clamp(5px, .6vw, 9px);
  background: #f2e6c6;
  color: #243b34;
  box-shadow: 0 1px 0 #cfb995, 0 2px 0 #a38c71, 1px 5px 5px #071b1a65;
  text-align: left;
}
.card-art {
  position: absolute;
  z-index: -1;
  inset: 3%;
  border-radius: 4%;
  box-shadow: inset 0 0 0 1px #20383666;
  background-color: #233c3c;
  background-image: url("deck.webp");
  background-size: 300% 200%;
  background-position: var(--sheet-x, 100%) var(--sheet-y, 100%);
  background-repeat: no-repeat;
}
.card-corner {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 30%;
  padding: 1% 4% 5%;
  border-radius: 3px 0 42% 0;
  background: #faf1da;
  color: var(--print);
}
.card-index {
  font: bold clamp(22px, 2.5vw, 33px)/1 Georgia, serif;
  font-variant-numeric: lining-nums;
}
.card-corner .suit-mark {
  width: clamp(10px, 1.15vw, 15px);
  height: clamp(10px, 1.15vw, 15px);
}
.card-suit {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: .24em 0 .27em;
  color: var(--print);
  background: #f6ebd0;
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
  font: 750 clamp(9px, .8vw, 11px)/1.03 system-ui, sans-serif;
  letter-spacing: .085em;
  text-transform: uppercase;
  text-align: center;
}
.hidden-card .card-back { inset: 3%; }
#incoming-clue {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto .7rem;
  padding: .24rem .6rem;
  border-left: 3px solid #99d5c3;
  border-radius: 2px;
  background: #153a34;
  color: #d6f3e9;
  font-size: .84rem;
}
.clue-ribbon {
  position: absolute;
  top: -3px;
  left: 9%;
  display: grid;
  place-items: center;
  width: 21px;
  height: 25px;
  padding-bottom: 4px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  background: #b1e2cf;
  color: #123a31;
  font: bold 15px/1 Georgia, serif;
}
.clue-ribbon .suit-mark { width: 14px; height: 14px; }
.slot {
  display: block;
  margin: 4px auto 0;
  color: #dfd8bd;
  font: 600 10px/1.4 ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.card[aria-pressed="true"], .hand .clue-match {
  z-index: 1;
  transform: translateY(-4px) rotate(0);
  box-shadow: 0 0 0 2px #263e36, 0 0 0 5px #fbe1a1, 0 7px 9px #0a1e1aa6;
}
.card[aria-pressed="true"]::after, .card.clue-match::after {
  content: "✓";
  position: absolute;
  top: -7px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid #42381c;
  border-radius: 50%;
  background: #ffe6a3;
  color: #2d321e;
  font: bold 12px/1 system-ui, sans-serif;
}
.card.clue-miss { filter: saturate(.48) brightness(.78); }
.hand button:disabled { opacity: 1; }
.hand button:focus-visible { outline: 3px solid #adf5ff; outline-offset: 3px; }
.hand button[aria-pressed="true"]:focus-visible { outline-offset: 6px; }
@media (hover: hover) {
  .hand button:hover:not(:disabled):not([aria-pressed="true"]) { transform: translateY(-3px); }
}
@media (prefers-reduced-motion: no-preference) {
  .hand .card { transition: transform 150ms ease, filter 150ms, box-shadow 150ms; }
}
.clue-slip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: 100%;
  margin: 2px auto;
  padding: 2px 5px;
  border: 1px solid #a38f62;
  border-radius: 2px;
  background: #fff0c9;
  color: #2e332d;
  font: 680 clamp(10px, 1vw, 12px)/1.1 system-ui, sans-serif;
  text-align: center;
  box-shadow: 0 1px 2px #0a201f5e;
}
.possible-slip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  gap: 3px;
  padding: 4px 2px;
  border-radius: 0 0 5px 5px;
  border-top: 1px solid #cab990;
  background: #f7ecd2;
  color: #343f39;
  text-align: center;
}
.possible-suits, .possible-numbers {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(1px, .27vw, 3px);
  font: 700 clamp(10px, .96vw, 13px)/1 system-ui, sans-serif;
}
.possible-suits > span {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--print);
}
.possible-suits .suit-mark { width: clamp(9px, 2.65vw, 14px); height: auto; }
.possible-numbers {
  gap: clamp(1px, .5vw, 4px);
  font-size: clamp(11px, 3.05vw, 14px);
  font-variant-numeric: tabular-nums;
}
.hand-key {
  margin: .45rem auto 0;
  width: min(100%, 31rem);
  color: #dce1d0;
  font-size: .77rem;
}
#card-odds {
  margin-top: .85rem;
  padding: .6rem .65rem;
  background: #142623;
  border: 1px solid #516457;
  border-radius: 6px;
}
#odds-title { font-size: .94rem; font-weight: 650; }
#play-odds { font-size: .8rem; color: var(--gold); }
.odds-grid {
  width: 100%;
  margin-top: .4rem;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
}
.odds-grid :is(td, th) { padding: .22rem 0; text-align: center; }
.odds-grid tbody tr { border-top: 1px solid #d0d7be22; }
.odds-grid th:first-child { text-align: left; }
.odds-grid thead th { color: var(--muted); font-size: .7rem; }
.odds-grid .suit-mark { display: inline-block; vertical-align: -.08em; color: var(--suit-light); margin-right: .26em; }
.odds-grid .impossible { color: #a0afa1; }
@media (max-width: 365px) {
  .possible-suits { gap: 0; }
}

.fireworks {
  position: relative;
  width: min(100%, 31rem);
  padding: 7px 10px 12px;
  gap: clamp(5px, 1.05vw, 12px);
  border: 1px solid #36291f;
  border-bottom: 4px solid #8d6946;
  border-radius: 6px;
  background: linear-gradient(#191c18, #30332b);
  box-shadow: inset 0 3px 5px #080c09, 0 1px #bd9b70, 0 3px 2px #15120f;
}
.firework {
  display: grid;
  min-width: 0;
  position: relative;
  aspect-ratio: 1.1;
  align-content: center;
  justify-items: center;
  border-radius: 6px;
}
.empty-stack {
  border: 1px solid #101511;
  border-bottom-color: #736d58;
  background: #21231f;
  box-shadow: inset 1px 3px 5px #090c09d9, inset 0 0 0 2px #33372c;
  color: var(--suit-light);
}
.empty-stack > .suit-mark {
  width: 30%;
  height: auto;
  opacity: .88;
  filter: drop-shadow(0 1px 1px #041a16);
}
.stack-suit {
  margin-top: 4px;
  font: 650 clamp(9px, .75vw, 10px)/1 system-ui, sans-serif;
  letter-spacing: .035em;
}
.stack-face {
  box-shadow: 0 1px #ae9b7c, 0 3px 3px #11150fcc;
}
.stack-face .card-art { background-size: 300% auto; background-position-y: 12%; }
.stack-face:is([data-color="blue"], [data-color="white"]) .card-art { background-position-y: 82%; }
.stack-face[data-top="2"] { box-shadow: 0 1px #9b8568, 0 3px #ebdab8, 0 4px 3px #11150fcc; }
.stack-face:is([data-top="3"], [data-top="4"], [data-top="5"]) {
  box-shadow: 0 1px #9b8568, 0 3px #ebdab8, 0 4px #9b8568, 0 6px #ebdab8, 0 7px 3px #11150fcc;
}
.stack-face .card-index { font-size: clamp(18px, 1.9vw, 25px); }
.stack-face .card-corner .suit-mark { width: 9px; height: 9px; }
.stack-face .card-suit { font-size: 9px; }
.stack-face[data-top="5"] { outline: 2px solid #eac779; outline-offset: 1px; }

.resources > div {
  position: relative;
  display: grid;
  grid-template-columns: max-content max-content;
  align-items: baseline;
  align-content: center;
  justify-content: center;
  gap: 3px 5px;
  margin: 0;
  padding: 0;
}
.resources dt {
  color: #dadbc9;
  font: 600 .76rem/1.2 system-ui, sans-serif;
}
.resources dd {
  display: contents;
  margin: 0;
}
.resources dd > :is(#clues, #lives, #remaining) {
  color: #fff1cf;
  font: 760 .83rem/1.1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.resources dd > .muted {
  /* The individual pieces below show capacity. Keep the denominator available to readers. */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.clue-tokens, .fuse-tokens {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 12px;
}
.clue-tokens i {
  display: block;
  flex: 0 0 auto;
  width: clamp(6px, 1.8vw, 9px);
  aspect-ratio: 1;
  border-radius: 100%;
  border: 1px solid #adcac1;
  background: #abd0c1;
  box-shadow: inset 0 0 0 1px #4d8478, 0 1px 0 #173830;
}
.clue-tokens i.spent { background: transparent; border-color: #729284; box-shadow: none; }
.fuse-tokens { gap: 4px; }
.fuse-tokens i {
  width: 5px;
  height: 11px;
  display: block;
  border-radius: 65% 35% 45% 50%;
  background: #ffa265;
  box-shadow: inset 1px -3px #bf5940, 0 1px #3e4034;
  transform: rotate(15deg);
}
.fuse-tokens i.spent { border: 1px solid #937f6f; background: transparent; box-shadow: none; }
.resources > .stock {
  grid-template-columns: max-content max-content;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 1px 8px;
}
.resources .stock::before {
  content: "";
  grid-column: 1;
  grid-row: 1 / 3;
  width: 19px;
  height: 27px;
  background: #18302f url("deck.webp") 100% 100% / 300% 200%;
  border: 1px solid #e4dbbc;
  border-radius: 2px;
  box-shadow: 1px 1px #6e7161, 2px 2px #d6c6a5, 3px 3px #5f6a59, 4px 4px #c4b08e;
  transform: rotate(-6deg);
}
.resources .stock dt, .resources .stock #remaining { grid-column: 2; }
.resources .empty-stock::before { background: transparent; border-style: dashed; box-shadow: none; }

.clue-choices, .clue-group { display: flex; flex-wrap: wrap; }
.clue-choices { flex-direction: column; gap: .32rem; }
.clue-group { gap: .3rem; }
.clue-group:empty { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .26em;
  padding: .23rem .47rem;
  min-height: 34px;
  min-width: 34px;
  border: 1px solid #708477;
  border-radius: 4px;
  background: #253e38;
  color: #f6e9c8;
  font: 650 .79rem/1 system-ui, sans-serif;
}
.chip[data-kind="rank"] { font: bold 1.06rem/1 Georgia, serif; }
.chip.empty-clue { border-style: dashed; }
.chip.empty-clue[data-kind="rank"] { font: 650 .79rem/1 system-ui, sans-serif; }
.chip .suit-mark { width: .95em; height: .95em; color: var(--suit-light); }
.chip[aria-pressed="true"] {
  background: #f8e6b8;
  color: #233b34;
  border-color: #ffeabd;
  box-shadow: inset 0 -2px #b99d64;
}
.chip[aria-pressed="true"] .suit-mark { color: var(--print); }
@media (hover: hover) {
  .chip:hover:enabled { border-color: #ffeabd; }
}
@media (pointer: coarse) {
  .chip { min-height: 42px; min-width: 42px; }
}
@media (max-width: 420px) {
  .hand > li:first-child { --tilt: -2deg; }
  .hand > li:last-child { --tilt: 2deg; }
  .card-index { font-size: 22px; }
  .slot { margin-top: 3px; }
}
@media (max-width: 540px) {
  .fireworks { padding: 5px 6px 9px; }
  #mobile-clue-panel .clue-group { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #mobile-clue-panel .chip { min-width: 0; flex-direction: column; gap: 2px; padding: 3px 1px; }
  #mobile-clue-panel .chip[data-kind="color"] { font-size: clamp(10px, 2.7vw, 12px); }
}
