/* Typeset */
.gm-typeset { display: flex; flex-direction: column; align-items: center; }

.ts-board { display: grid; grid-template-rows: repeat(6, var(--gm-tile)); gap: 6px; margin: 4px auto 0; perspective: 600px; }
.ts-row { display: grid; grid-template-columns: repeat(5, var(--gm-tile)); gap: 6px; }
.ts-tile { position: relative; user-select: none; }

/* Not by color alone: a bar under right-spot letters, a dot under wrong-spot ones. */
.ts-tile.hit::after, .ts-tile.near::after { content: ""; position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); }
.ts-tile.hit::after { width: 16px; height: 3px; background: #fff; }
.ts-tile.near::after { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }

.ts-tile.pop { animation: ts-pop .1s ease-out; }
.ts-tile.flip { animation: ts-flip .5s ease-in-out both; }
.ts-tile.jump { animation: ts-jump .5s var(--ease) both; }
.ts-row.shake { animation: ts-shake .4s ease-in-out; }
@keyframes ts-pop { 50% { transform: scale(1.08); } }
@keyframes ts-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(-90deg); } 100% { transform: rotateX(0); } }
@keyframes ts-jump { 30% { transform: translateY(-14px); } 55% { transform: translateY(2px); } 75% { transform: translateY(-4px); } }
@keyframes ts-shake { 15%, 55% { transform: translateX(-7px); } 35%, 75% { transform: translateX(7px); } 90% { transform: translateX(-2px); } }

.ts-foot { min-height: 0; text-align: center; }
.ts-foot:not(:empty) { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; }
.ts-foot p { margin: 0; font-size: 17px; }
.ts-word { letter-spacing: .08em; background: var(--hl); padding: 0 4px; }

.ts-kb { width: 100%; }
.ts-kb button svg { display: block; margin: 0 auto; }
.ts-kb button:focus-visible { outline: 3px solid var(--cite); outline-offset: 2px; }
.ts-kb button.hit { box-shadow: inset 0 -4px 0 rgba(255,255,255,.55); }
.ts-kb button.near { box-shadow: inset 0 -4px 0 rgba(0,0,0,.35); }

.ts-opts { margin: 20px 0 0; font-size: 14px; color: var(--quiet); max-width: 500px; width: 100%; }
.ts-opts label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.ts-opts input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--cite); flex: none; }
.ts-opts input:disabled + span { opacity: .55; }
.ts-opts b { color: var(--ink); margin-right: 4px; }

.ts-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }

/* How-to legend */
.ts-key { list-style: none; padding: 0 !important; }
.ts-key li { display: flex; align-items: center; gap: 12px; }
.ts-mini { --gm-tile: 36px; font-size: 20px; flex: none; position: relative; }
.ts-mini.hit::after, .ts-mini.near::after { content: ""; position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); }
.ts-mini.hit::after { width: 12px; height: 2px; background: #fff; }
.ts-mini.near::after { width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }

@media (max-width: 400px) {
  .gm-typeset { --gm-tile: 50px; }
  .ts-board, .ts-row { gap: 5px; }
  .gm-kb button.wide { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .ts-tile.pop, .ts-tile.flip, .ts-tile.jump, .ts-row.shake { animation: none; }
}
