/* The Mystery hand and the Closest hand (28 Nov 2026; templates/mystery.html, closest.html). The tiles are the site's own
   drawing (.figure in cardlines.css, tiles.js); this sets their sizes here, the Coach's line, the card's lines and the
   result. Built on the puzzle pages' look (puzzle.css). */
.hand-drill { max-width: 56rem; }
.hand-drill [hidden] { display: none !important; }
.hand-drill h2 { font-size: 1.35rem; margin-top: 1.6rem; }
.hand-drill .fine { color: var(--ink-soft, inherit); }

.md-modes { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.4rem 0 0.2rem; }
.md-modes .button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--accent); }

/* the hand: fourteen tiles, two rows of seven */
.md-hand { --tile-scale: 0.8; display: grid; grid-template-columns: repeat(7, max-content); gap: 10px; justify-content: start; margin: 0.5rem 0; }
.md-hand .tile.up { animation: md-turn 0.35s ease; }
@keyframes md-turn { from { transform: rotateY(90deg); } to { transform: rotateY(0); } }
.md-count { margin: 0.2rem 0 0; font-weight: 700; }

/* the Coach's line */
.md-kora { display: flex; gap: 0.9rem; align-items: center; margin: 1rem 0; padding: 0.8rem 1rem; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--felt); }
.md-kora-face { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; }
.md-kora-said { margin: 0; font-size: 1.1rem; font-weight: 600; }

/* the 36 kinds of tile, nine to a row */
.md-tilegrid { --tile-scale: 0.6; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; max-width: 34rem; }
.md-tilegrid .md-kind { width: 100%; height: auto; aspect-ratio: 58 / 81; cursor: pointer; font: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease; }
.md-tilegrid .md-kind:hover:not(:disabled) { transform: translateY(-3px); }
.md-tilegrid .md-kind:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.md-tilegrid .md-kind:disabled { cursor: default; }
.md-tilegrid .md-kind.named { opacity: 0.55; }
.md-tilegrid .md-kind.named:not(.miss) { opacity: 1; box-shadow: 0 0 0 3px var(--felt); }
.md-badge { position: absolute; right: 2px; bottom: 2px; min-width: 1.5em; padding: 0 0.25em; border-radius: 999px; background: #232019; color: #fff;
  font: 700 0.8rem/1.5 var(--sans, sans-serif); text-align: center; }

/* the card's lines: a button each, its words over its tiles */
.md-filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin: 0.4rem 0 0.8rem; }
.md-check, .md-select { display: inline-flex; gap: 0.4rem; align-items: center; font: inherit; }
.md-select select { font: inherit; padding: 0.4rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; max-width: 60vw; }
.md-lines { display: grid; gap: 0.6rem; }
.md-line { display: grid; gap: 0.3rem; justify-items: start; text-align: left; font: inherit; padding: 0.6rem 0.8rem; cursor: pointer;
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--card); color: inherit; width: 100%; }
.md-line:hover:not(:disabled) { border-color: var(--accent); }
.md-line:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.md-line.tried { opacity: 0.45; cursor: default; }
.md-line-said { font-weight: 700; margin: 0; }
.md-line .pattern { margin: 0; }

/* the result */
.md-done { margin: 1.4rem 0; padding: 0.4rem 1rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.md-result { font-family: var(--display); font-size: 1.5rem; font-weight: 700; margin: 0.4rem 0; }
.md-next { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1rem; }
.md-answer .pattern { margin: 0.2rem 0; }

/* the Closest hand */
.ch-status { display: flex; justify-content: space-between; gap: 1rem; font-weight: 700; font-size: 1.15rem; }
.ch-status p { margin: 0.4rem 0; }
.ch-rack { --tile-scale: 0.8; display: grid; grid-template-columns: repeat(7, max-content); gap: 10px; justify-content: start; margin: 0.5rem 0; }
.ch-result { margin: 1rem 0; }
.ch-overlay { margin: 1rem 0; }
.ch-overlay h3 { margin: 0 0 0.2rem; font-size: 1.1rem; }
.ch-groups { --tile-scale: 0.5; gap: 10px; }
.ch-groups .figure-group { flex-wrap: nowrap; }
.ch-rounds { padding-left: 1.4rem; display: grid; gap: 0.2rem; }

@media (max-width: 34rem) {
  .md-hand, .ch-rack { --tile-scale: 0.6; gap: 6px; }
  .md-tilegrid { gap: 5px; --tile-scale: 0.4; }
  .ch-groups { --tile-scale: 0.4; gap: 8px; }
  .ch-groups .figure-group { flex-wrap: wrap; gap: 2px; }
  .md-kora { padding: 0.6rem 0.7rem; }
  .md-kora-face { width: 48px; height: 48px; }
  .md-kora-said { font-size: 1rem; }
  .md-line .pattern { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .md-hand .tile.up { animation: none; }
  .md-tilegrid .md-kind { transition: none; }
}
