/* Sorted. Group colors run easiest to trickiest: highlighter, pale footnote blue, grey-green, ink. */
:root {
  --so-1: var(--hl);
  --so-2: #C9D8F4;
  --so-3: #C6D3C0;
  --so-4: var(--ink);
  --so-h: 64px;
}

.gm-sorted { max-width: 600px; margin: 0 auto; }

.so-found, .so-grid { display: grid; gap: 8px; }
.so-found:not(:empty) { margin-bottom: 8px; }
.so-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.so-grid.shake { animation: so-shake .4s ease-in-out; }

.so-tile { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; height: var(--so-h); padding: 0 4px;
  border: 2px solid var(--rail); border-radius: 6px; background: var(--wash); color: var(--ink);
  font: 800 17px/1 var(--sans); letter-spacing: .02em; text-transform: uppercase; cursor: pointer; user-select: none;
  touch-action: manipulation; transition: background .12s var(--ease), border-color .12s var(--ease), transform .12s var(--ease); }
.so-tile span { white-space: nowrap; }
.so-tile span.two { display: flex; flex-direction: column; align-items: center; gap: 3px; line-height: 1.05; }
.so-tile span.two span { display: block; }
.so-tile:hover { border-color: var(--faint); }
.so-tile:active { transform: scale(.97); }
.so-tile.on { background: #2B2B2B; border-color: #2B2B2B; color: var(--paper); }
/* A corner tick on selected tiles, so selection isn't shown by color alone. */
.so-tile.on::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--hl); }
.so-tile:focus-visible, .so-acts .gm-btn:focus-visible, .so-end .gm-btn:focus-visible { outline: 3px solid var(--cite); outline-offset: 2px; }
.so-tile.hop { animation: so-hop .32s var(--ease); }
.so-tile.pop { animation: so-pop .25s var(--ease); }

.so-band { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: var(--so-h);
  padding: 8px 12px; border-radius: 6px; text-align: center; color: var(--ink); }
.so-band strong { font-size: 15px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1.15; }
.so-band span { font-size: 15px; text-transform: uppercase; letter-spacing: .03em; line-height: 1.25; }
.so-band.l1 { background: var(--so-1); }
.so-band.l2 { background: var(--so-2); }
.so-band.l3 { background: var(--so-3); }
.so-band.l4 { background: var(--so-4); color: var(--paper); }
.so-band.missed { box-shadow: inset 0 0 0 2px rgba(0,0,0,.18); }
.so-band.l4.missed { box-shadow: inset 0 0 0 2px rgba(255,255,255,.3); }
.so-band.in { animation: so-in .45s var(--ease) both; }

.so-lives { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 18px 0 0; font-size: 15px; color: var(--quiet); }
.so-dots { display: inline-flex; gap: 7px; }
.so-dots i { width: 13px; height: 13px; border-radius: 50%; background: var(--ink); border: 2px solid var(--ink); transition: background .2s var(--ease), transform .2s var(--ease); }
.so-dots i.used { background: transparent; border-color: var(--faint); transform: scale(.85); }

.so-acts { display: flex; justify-content: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.so-acts .gm-btn { min-width: 108px; }

.so-end { text-align: center; }
.so-end:not(:empty) { margin-top: 20px; }
.so-end p { margin: 0 0 12px; font-size: 17px; }

.so-share { display: inline-flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; }
.so-share div { display: flex; gap: 4px; }
.so-share i { width: 22px; height: 22px; border-radius: 3px; }
.so-share i.l1 { background: var(--so-1); }
.so-share i.l2 { background: var(--so-2); }
.so-share i.l3 { background: var(--so-3); }
.so-share i.l4 { background: var(--so-4); }

/* Stats labels here are words ("2 mistakes"), wider than the shared default. */
.gm-hrow { grid-template-columns: 6.6em 1fr; }

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

@keyframes so-hop { 40% { transform: translateY(-8px); } 100% { transform: translateY(0); } }
@keyframes so-pop { 0% { transform: scale(.92); opacity: .6; } 100% { transform: scale(1); opacity: 1; } }
@keyframes so-in { 0% { transform: scale(.94); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes so-shake { 15%, 55% { transform: translateX(-6px); } 35%, 75% { transform: translateX(6px); } 90% { transform: translateX(-2px); } }

@media (max-width: 640px) {
  :root { --so-h: 58px; }
  .so-found, .so-grid { gap: 6px; }
  .so-tile { font-size: 15px; padding: 0 1px; }
  .so-band strong, .so-band span { font-size: 13px; }
  .so-acts { gap: 8px; }
  .so-acts .gm-btn { min-width: 0; flex: 1 1 0; padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .so-tile, .so-dots i { transition: none; }
  .so-tile.hop, .so-tile.pop, .so-band.in, .so-grid.shake { animation: none; }
}
