/* The free card tools (/games/cribbage/calculator/, /games/gin-rummy/helper/): picker, result panel, cheat sheet.
   Garden tokens only. Phones first: every button is 44 px or more. */

.ct-tool { display: grid; gap: 18px; background: var(--gg-paper); border: var(--gg-border); border-radius: var(--gg-r-xl); box-shadow: var(--gg-shadow-lg); padding: 16px; }
@media (min-width: 720px) {
  .ct-tool { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; padding: 24px; gap: 28px; }
}
.ct-tool > * { min-width: 0; }
.ct-tool + .guide-toc { margin-top: 20px; }
.ct-tool__input { display: grid; gap: 14px; align-content: start; }
@media (max-width: 599px) { .ct-tool { padding: 14px 10px; } }
.ct-tool__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ct-tool__head .gg-seg { flex: 0 0 auto; }
.ct-examples { display: flex; flex-wrap: wrap; gap: 8px; }

/* picker */
.ct-picker { display: grid; gap: 12px; min-height: 300px; }
.ct-slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.ct-slotwrap { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.ct-slotwrap--starter { padding-left: 8px; border-left: 2px dashed var(--gg-ink-3); }
.ct-slot {
  --gg-card-w: 100%;
  width: 100%; max-width: 76px; aspect-ratio: 5 / 7; padding: 0; border: 2px dashed var(--gg-ink-3); border-radius: 10px;
  background: var(--gg-cream); display: grid; place-items: center; cursor: pointer; font: inherit; color: var(--gg-ink-3);
  transition: transform var(--gg-dur-xs) ease;
}
.ct-slot:active { transform: scale(.96); }
.ct-slot.is-filled { border: 0; background: none; }
.ct-slot.is-active { outline: 3px solid var(--gg-lime); outline-offset: 2px; border-color: var(--gg-ink); background: var(--gg-lime-100); }
.ct-slot .gg-card { width: 100%; height: 100%; --gg-card-w: 100%; pointer-events: none; }
.ct-slot__plus { font-family: var(--gg-font-display); font-weight: 800; font-size: 26px; line-height: 1; }
.ct-slot__label { font-size: var(--gg-text-xs); font-weight: 700; color: var(--gg-ink-3); white-space: nowrap; }
.ct-hint { margin: 0; min-height: 2.6em; font-size: var(--gg-text-sm); color: var(--gg-ink-2); font-weight: 600; }
.ct-suits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ct-suit, .ct-rank {
  min-height: 48px; min-width: 44px; border: var(--gg-border); border-radius: var(--gg-r-sm); background: var(--gg-card-face);
  font-family: var(--gg-font-display); font-weight: 800; font-size: 22px; color: var(--gg-ink); cursor: pointer; box-shadow: var(--gg-shadow-sm);
  transition: transform var(--gg-dur-xs) ease;
}
.ct-suit.is-red, .ct-rank.is-red { color: var(--gg-suit-red); }
.ct-suit[aria-pressed="true"] { background: var(--gg-butter); box-shadow: inset 0 0 0 2px var(--gg-ink); }
.ct-suit:active, .ct-rank:active { transform: translateY(2px); box-shadow: none; }
.ct-ranks { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ct-rank:disabled { opacity: .3; cursor: default; box-shadow: none; }
@media (min-width: 600px) { .ct-ranks { gap: 6px; } }

/* ten slots (gin): two rows of five */
.ct-picker--ten .ct-slots { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ct-picker--ten .ct-slot { max-width: 68px; }
/* six slots (best discard): one row */
.ct-picker--six .ct-slots { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }

/* result */
.ct-result { display: grid; gap: 14px; align-content: start; scroll-margin-top: 84px; }
.ct-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ct-total__num { font-family: var(--gg-font-display); font-weight: 800; font-size: 64px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ct-total__unit { font-weight: 800; font-size: var(--gg-text-lg); }
.ct-said { margin: 0; padding: 12px 14px; background: var(--gg-butter-100); border: var(--gg-border); border-radius: var(--gg-r-md); font-weight: 700; line-height: 1.5; }
.ct-empty { margin: 0; color: var(--gg-ink-2); line-height: 1.5; }
.ct-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-chips .gg-pill { font-size: var(--gg-text-xs); min-height: 32px; }
.ct-chips .gg-pill.is-zero { opacity: .55; }
.ct-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ct-step { display: grid; grid-template-columns: 52px 1fr; gap: 4px 10px; align-items: center; padding: 8px 10px; border: var(--gg-border); border-radius: var(--gg-r-md); background: var(--gg-cream); }
.ct-step__pts { grid-row: span 2; display: grid; place-items: center; height: 40px; border-radius: var(--gg-r-pill); background: var(--gg-lime); border: var(--gg-border); font-weight: 800; font-variant-numeric: tabular-nums; }
.ct-step__say { font-weight: 800; }
.ct-step__why { font-size: var(--gg-text-sm); color: var(--gg-ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.ct-mini {
  display: inline-flex; align-items: center; justify-content: center; min-width: 32px; padding: 1px 5px; border: 1.5px solid var(--gg-ink); border-radius: 6px;
  background: var(--gg-card-face); font-weight: 800; font-size: var(--gg-text-sm); color: var(--gg-ink); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ct-mini.is-red { color: var(--gg-suit-red); }
.ct-minis { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ct-verdict { margin: 0; padding: 12px 14px; border: var(--gg-border); border-radius: var(--gg-r-md); font-weight: 800; font-size: var(--gg-text-lg); line-height: 1.35; }
.ct-verdict small { display: block; font-weight: 600; font-size: var(--gg-text-sm); color: var(--gg-ink-2); margin-top: 4px; }
.ct-verdict--gin { background: var(--gg-lime); }
.ct-verdict--knock { background: var(--gg-lime-100); }
.ct-verdict--no { background: var(--gg-sand); }
.ct-groups { display: grid; gap: 8px; }
.ct-group { display: grid; gap: 6px; padding: 10px 12px; border: var(--gg-border); border-radius: var(--gg-r-md); background: var(--gg-cream); }
.ct-group__head { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; }
.ct-group--dead { background: var(--gg-sand); }
.ct-group__sum { font-size: var(--gg-text-sm); color: var(--gg-ink-2); font-weight: 600; }

/* "what if" stepper (gin) */
.ct-whatif { display: grid; gap: 10px; padding: 12px 14px; border: var(--gg-border); border-radius: var(--gg-r-md); background: var(--gg-paper); }
.ct-whatif__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ct-stepper { display: inline-flex; align-items: center; gap: 6px; }
.ct-stepper .gg-btn { font-size: 24px; font-weight: 800; }
.ct-stepper output { min-width: 44px; text-align: center; font-family: var(--gg-font-display); font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; }
.ct-whatif p { margin: 0; line-height: 1.5; }

/* best discard list (cribbage) */
.ct-throws { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ct-throw { display: grid; gap: 6px; padding: 10px 12px; border: var(--gg-border); border-radius: var(--gg-r-md); background: var(--gg-cream); }
.ct-throw.is-best { background: var(--gg-lime-100); }
.ct-throw__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ct-throw__val { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.ct-throw__why { font-size: var(--gg-text-sm); color: var(--gg-ink-2); }

/* cheat sheet table */
.ct-sheet { width: 100%; max-width: 640px; border-collapse: collapse; background: var(--gg-paper); border: var(--gg-border); border-radius: var(--gg-r-md); overflow: hidden; }
.ct-sheet th, .ct-sheet td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--gg-line); line-height: 1.4; vertical-align: top; }
.ct-sheet td:last-child, .ct-sheet th:last-child { text-align: right; white-space: nowrap; font-weight: 800; font-variant-numeric: tabular-nums; }
.ct-sheet thead th { background: var(--gg-sand); font-size: var(--gg-text-sm); }
.ct-sheet tbody th { font-weight: 700; }
.ct-sheet td { color: var(--gg-ink-2); }
#cheat-sheet h3 { font-size: var(--gg-text-lg); font-weight: 800; margin-top: 4px; }

@media print {
  .gg-appbar, .site-foot, .crumbs, .guide-toc, .house-slot, .guide-end, .ct-noprint, .gg-consent { display: none !important; }
  body.ct-print-sheet main > :not(#cheat-sheet) { display: none !important; }
  body { background: #fff; }
  .ct-sheet th, .ct-sheet td { padding: 5px 10px; }
  #cheat-sheet { gap: 8px; padding-top: 0; }
  .ct-sheet { box-shadow: none; }
}
