/* Play: the hub, the match framework (games/match.js) and the classic boards. */

/* ── hub ── */
.game-top { margin-bottom: 8px; }
.game-search { width: 100%; min-height: 44px; border-radius: 999px; border: 1px solid var(--rule); background: var(--raised); color: var(--ink); padding: 0 18px; font: inherit; }
.game-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.game-cats .chip { flex: none; }
.game-grid { gap: 12px; }
.game-card { padding: 14px 10px 12px; min-width: 0; }
.game-card b { line-height: 1.2; }
.game-card small { line-height: 1.3; }
.game-modes { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 6px; }
.game-modes .mpill { display: inline-flex; align-items: center; gap: 3px; margin: 0; font-size: .68rem; padding: 2px 7px; }
.game-modes .mpill .k-ic, .game-modes .mpill .ticon { font-size: .8rem; }

/* ── ways to play ── */
.gm { max-width: 560px; margin: 0 auto; }
.gm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.gm-head h2 { margin: 0; }
.gm-head-i { font-size: 2.2rem; line-height: 1; }
.gm-mode { background: var(--raised); border: 1px solid var(--rule); border-radius: 18px; margin-bottom: 10px; overflow: hidden; }
.gm-mode-b { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 14px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; min-height: 60px; }
.gm-mode-b:active { background: var(--me-tint); }
.gm-mode-b b { display: block; }
.gm-mode-b small { display: block; color: var(--ink-soft); }
.gm-mode-i { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--me-tint); color: var(--me-strong, var(--me)); font-size: 1.2rem; flex: none; }
.gm-mode-x { padding: 0 14px 12px 66px; display: grid; gap: 8px; }
.gm-levels { display: flex; gap: 6px; flex-wrap: wrap; }
.gm-count { display: flex; align-items: center; gap: 8px; }
.gm-count > span { min-width: 64px; color: var(--ink-soft); font-size: .9rem; }
.gm-count .chip { min-width: 38px; justify-content: center; }
.gm-record { display: block; }
.gm-friend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.gm-friend { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--rule); background: var(--raised); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.gm-friend img, .gm-friend .gm-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.gm-friend .gm-av { display: grid; place-items: center; background: var(--me-tint); font-weight: 800; }
.gm-friend small { display: block; }
.gm-rules ul { padding-left: 20px; display: grid; gap: 8px; line-height: 1.45; }

/* ── the match ── */
.gm-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.gm-mode-tag { font-size: .8rem; color: var(--ink-soft); text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-score { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.gm-sc { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--raised); border: 1px solid var(--rule); transition: background .25s, border-color .25s, transform .25s; }
.gm-sc small { color: var(--ink-soft); max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-sc b { font-variant-numeric: tabular-nums; }
.gm-sc.on { border-color: var(--me); background: var(--me-tint); transform: translateY(-1px); }
.gm-status { text-align: center; font-weight: 800; min-height: 1.5em; margin: 6px 0 12px; transition: color .2s; }
.gm-status.mine { color: var(--me-strong, var(--me)); }
.gm-status.win { color: var(--good); animation: gm-pop .45s var(--spring, ease); }
.gm-status.lose { color: var(--bad); }
.gm-board { display: flex; justify-content: center; }
.gm-board > * { width: 100%; }
.gm-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.gm-curtain { display: grid; justify-items: center; gap: 14px; padding: 40px 16px; border-radius: 22px; background: var(--raised); border: 1px dashed var(--rule); text-align: center; font-weight: 800; }
.gm-badge { font-size: .95rem; line-height: 1; }
.gm-disc { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.gm-disc.p0 { background: radial-gradient(circle at 35% 30%, #fff, var(--you, #f5b041)); }
.gm-disc.p1 { background: radial-gradient(circle at 35% 30%, #a77a65, var(--mocha, #6b4636)); }
@keyframes gm-pop { 0% { transform: scale(.85); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* a generic grid of cells (match.js grid()) */
.gm-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 8px; margin: 0 auto; }
.gm-cell { aspect-ratio: 1; border: 0; border-radius: 16px; background: var(--raised); color: var(--ink); box-shadow: 0 5px 0 var(--rule); font-size: 2rem; cursor: pointer; padding: 0; transition: transform .2s var(--spring, ease), background .2s; display: grid; place-items: center; }
.gm-cell:disabled { cursor: default; }
.gm-cell:not(:disabled):active { transform: translateY(4px); box-shadow: 0 1px 0 var(--rule); }
.gm-cell.win { background: var(--me-tint); box-shadow: 0 5px 0 var(--me); animation: beat 1s infinite; }

/* tic-tac-toe */
.ttt-g { max-width: 330px; gap: 10px; }
.ttt-g .gm-cell { font-size: 2.6rem; border-radius: 22px; }
.ttt-g .gm-cell.taken { animation: gm-pop .3s var(--spring, ease); }
.ttt-g .gm-cell.last:not(.win) { box-shadow: 0 5px 0 color-mix(in srgb, var(--me) 45%, var(--rule)); }

/* connect four */
.c4g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; background: linear-gradient(160deg, color-mix(in srgb, var(--me) 70%, white), var(--me)); padding: 10px; border-radius: 22px; max-width: 400px; margin: 0 auto; box-shadow: 0 8px 0 var(--me-strong, var(--me)), 0 16px 30px var(--glow, transparent); }
.c4c { aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--paper); cursor: pointer; padding: 0; box-shadow: inset 0 3px 0 rgba(0, 0, 0, .12); }
.c4c:disabled { cursor: default; }
.c4c.p0 { background: radial-gradient(circle at 35% 30%, #fff, var(--you, #f5b041)); }
.c4c.p1 { background: radial-gradient(circle at 35% 30%, #a77a65, var(--mocha, #6b4636)); }
.c4c.drop { animation: c4-drop .45s cubic-bezier(.3, 1.4, .6, 1); }
.c4c.win { box-shadow: 0 0 0 3px #fff, 0 0 16px #fff; animation: beat 1s infinite; }
@keyframes c4-drop { from { transform: translateY(calc(-110% * (var(--row) + 1))); } to { transform: none; } }

/* rock paper scissors */
.rps-tally { text-align: center; font-weight: 800; margin-bottom: 6px; }
.rps-reveal.pop b { animation: gm-pop .4s var(--spring, ease); }
.rps-hist { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 14px; }
.rps-hist span { padding: 2px 8px; border-radius: 999px; background: var(--raised); border: 1px solid var(--rule); font-size: .9rem; }
.rps-hist .won { border-color: var(--good); }
.rps-hist .lost { border-color: var(--bad); }

/* guess my word */
.word-set { max-width: 360px; margin: 0 auto; }
.word-slots span.got { animation: gm-pop .3s var(--spring, ease); }
.word-hearts { letter-spacing: 2px; }

/* memory duel */
.mem-g { max-width: 360px; gap: 9px; perspective: 700px; }
.mem-g .gm-cell { font-size: 1.8rem; border-radius: 14px; background: linear-gradient(150deg, color-mix(in srgb, var(--me) 75%, white), var(--me)); transition: transform .35s, background .2s; }
.mem-g .gm-cell.open { background: var(--raised); transform: rotateY(180deg) scaleX(-1); }
.mem-g .gm-cell.done { opacity: .55; }
.mem-g .gm-cell.own0 { box-shadow: 0 5px 0 var(--you, #f5b041); }
.mem-g .gm-cell.own1 { box-shadow: 0 5px 0 var(--mocha, #6b4636); }
.memory button { font-size: 1.8rem; }

/* draw together */
.chip.swatch { width: 34px; height: 34px; padding: 0; border: 2px solid var(--rule); }
.chip.swatch.on { outline: 3px solid var(--me); outline-offset: 2px; }

@media (max-width: 380px) {
  .gm-mode-x { padding-left: 14px; }
  .gm-cell { border-radius: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .gm *, .gm *::before { animation: none !important; transition: none !important; }
}
