/* Memory (owner request, 2026-10-25). The cards lie scattered face down on
   the felt; a turned card flips over where it lies and a pair flies to its
   player. Only transforms and opacity change, and nothing loops. */
.memory-tile .game-tile-art{background:radial-gradient(ellipse at 30% 25%,#c9a35a44,transparent 60%),linear-gradient(150deg,#2d5a4a,#173f35)}
.memory-tile-art{position:absolute;left:50%;top:50%;width:228px;height:168px;transform:translate(-50%,-50%)}
.memory-tile-art .playing-card{position:absolute;width:64px;height:90px}
.memory-tile-card.one{left:0;top:4px;transform:rotate(-8deg)}
.memory-tile-card.two{left:80px;top:0;transform:rotate(4deg);box-shadow:0 0 0 3px #f3cf7b,0 8px 16px #00000033}
.memory-tile-card.three{left:160px;top:6px;transform:rotate(-3deg)}
.memory-tile-card.four{left:6px;top:76px;transform:rotate(5deg)}
.memory-tile-card.five{left:86px;top:74px;transform:rotate(-6deg);box-shadow:0 0 0 3px #f3cf7b,0 8px 16px #00000033}
.memory-tile-card.six{left:164px;top:80px;transform:rotate(7deg)}
.memory-tile-art .simple-card .card-value,.memory-tile-art .simple-card .card-suit{font-size:26px}
@media (max-width:580px){.memory-tile-art{transform:translate(-50%,-50%) scale(.9)}}
.memory-rules-card h2{font-size:1.5rem}
/* Create form: the card count and the table rule, styled like the other games' choices. */
.memory-rule-pick{border:1px solid var(--line);border-radius:12px;padding:10px 12px 6px;margin:0;display:grid;gap:4px}
.memory-rule-pick legend{font-size:.78rem;font-weight:650;padding:0 4px}
.memory-rule-pick .option-row{display:flex;gap:10px;align-items:flex-start;padding:6px 2px;cursor:pointer}
.memory-rule-pick .option-row input{margin-top:4px}
.memory-rule-pick .option-row strong{display:block;font-size:.86rem}
.memory-rule-pick .option-row small{display:block;color:var(--muted);font-size:.74rem;line-height:1.45}

.memory-surface{display:flex;flex-direction:column;gap:10px;min-height:0}
.memory-surface .surface-top{display:flex;align-items:center;justify-content:space-between;gap:10px}
.memory-left{font-size:.75rem;font-weight:700;color:#d6e6cc;white-space:nowrap}

/* Who has how many pairs; the player turning cards is outlined. */
.memory-players{display:flex;flex-wrap:wrap;justify-content:center;gap:6px}
.memory-chip{display:flex;align-items:center;gap:6px;min-width:0;padding:3px 10px 3px 3px;border-radius:999px;background:#0d2e2366;color:#f1ecd2;font-size:.82rem;border:1.5px solid transparent;transition:border-color .2s,background-color .2s}
.memory-chip.active{border-color:#f3cf7b;background:#6a5a2a99}
.memory-chip.away{opacity:.65}
.memory-chip-face{display:grid;place-items:center;width:28px;height:28px;flex-shrink:0;border-radius:50%;background:#e4e9da;color:#203a31;font-weight:750;overflow:hidden}
.memory-chip-face svg,.memory-chip-face .gh-face{display:block;width:100%;height:100%}
.memory-chip-name{max-width:9em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.memory-chip-count{min-width:1.4em;padding:1px 6px;border-radius:9px;background:#f3cf7b;color:#203a31;font-size:.78rem;text-align:center;font-variant-numeric:tabular-nums}

/* The layout: a grid of places, each card leaning a little. Phones get six
   or eight columns; wider screens lay the cards out in long rows. */
.memory-board{--cols:8;display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));gap:clamp(4px,1.4vw,10px);width:100%;max-width:1000px;margin:0 auto;padding:6px 2px 10px}
.memory-board[data-cards="24"],.memory-board[data-cards="36"]{--cols:6}
@media (min-width:700px){.memory-board[data-cards="24"]{--cols:8}.memory-board[data-cards="36"]{--cols:9}.memory-board[data-cards="52"]{--cols:13}}
@media (min-width:700px) and (max-height:820px){.memory-board{max-width:min(1000px,calc((100vh - 230px) * 2.5))}}
.memory-card{position:relative;display:block;width:100%;min-height:0;aspect-ratio:5/7;padding:0;margin:0;border:0;border-radius:10%;background:none;color:inherit;container-type:inline-size;-webkit-tap-highlight-color:transparent}
.memory-card:disabled{opacity:1;cursor:default}
.memory-card.can-flip{cursor:pointer}
.memory-tilt{position:absolute;inset:0;transform:rotate(var(--tilt)) translate(var(--dx),var(--dy))}
/* A face-down card is these rules alone, no card markup: the back of the
   GameHub deck (2026-10-25, to keep redraws of a full deck light). Nothing
   here uses 3D, so a resting table holds no extra layers for the phone's
   graphics chip. */
.memory-inner{position:absolute;inset:0;box-sizing:border-box;border:6cqw solid #e4dbbd;border-radius:10cqw;background-color:#839276;background-image:repeating-linear-gradient(45deg,transparent 0,transparent 7px,#ffffff19 7px,#ffffff19 8px),repeating-linear-gradient(-45deg,transparent 0,transparent 7px,#ffffff19 7px,#ffffff19 8px);box-shadow:0 2px 5px #0b221a40;transition:opacity .3s ease,transform .3s ease}
.memory-inner::after{content:"♣";position:absolute;inset:4cqw;display:grid;place-items:center;border:1px solid #e4dbbd99;border-radius:4cqw;color:#e4dbbd;font-size:36cqw;line-height:1}
.memory-front{position:absolute;inset:-6cqw;z-index:1}
/* Turning a card: it narrows to its edge and opens on the other side, flat,
   and only the card being turned moves. Face up, the face covers the back. */
.memory-card.is-up .memory-inner{animation:memory-turn-up .3s}
.memory-card.is-up .memory-front{animation:memory-face-in .3s}
.memory-card.turned-back .memory-inner{animation:memory-turn-down .3s}
.memory-card.turned-back .memory-front{opacity:0;animation:memory-face-out .3s}
.memory-card.is-taken .memory-inner{transform:scale(.6);opacity:0}
.memory-card.memory-gone .memory-inner{opacity:0;transition:none}
@keyframes memory-turn-up{0%{transform:scaleX(1);animation-timing-function:ease-in}50%{transform:scaleX(.02);animation-timing-function:ease-out}100%{transform:scaleX(1)}}
@keyframes memory-turn-down{0%{transform:scaleX(1);animation-timing-function:ease-in}50%{transform:scaleX(.02);animation-timing-function:ease-out}100%{transform:scaleX(1)}}
@keyframes memory-face-in{0%,50%{opacity:0}51%,100%{opacity:1}}
@keyframes memory-face-out{0%,50%{opacity:1}51%,100%{opacity:0}}
.memory-card .playing-card{width:100%;height:100%;margin:0;border-radius:10cqw;box-shadow:0 2px 5px #0b221a40}
/* Faces show the rank and suit large and centred, readable on small cards. */
.memory-card .playing-card.simple-card{align-items:center;justify-content:center}
.memory-card .simple-card .card-value{font-size:max(11px,44cqw);margin:0;letter-spacing:-.06em}
.memory-card .simple-card .card-suit{font-size:max(11px,40cqw);margin:2cqw 0 0}
/* Your turn: the face-down cards you can turn get a soft gold edge. */
.memory-card.can-flip .memory-inner{box-shadow:0 0 0 1.5px #f3cf7b99,0 2px 5px #0b221a40}
.memory-card.can-flip:hover .memory-inner{box-shadow:0 0 0 2.5px #f3cf7b,0 3px 8px #0b221a55}
.memory-card.pair .playing-card{box-shadow:0 0 0 2.5px #f3cf7b,0 0 12px #f3cf7bcc}
.memory-card.miss .playing-card{box-shadow:0 0 0 2.5px #e98b7a,0 2px 5px #0b221a40}
.memory-flight{position:fixed;left:0;top:0;z-index:40;pointer-events:none;container-type:inline-size}
.memory-flight .playing-card{width:100%;height:100%;border-radius:10cqw}
.memory-flight .playing-card.simple-card{align-items:center;justify-content:center}
.memory-flight .simple-card .card-value{font-size:max(11px,44cqw);margin:0}
.memory-flight .simple-card .card-suit{font-size:max(11px,40cqw);margin:2cqw 0 0}
body.animations-off .memory-inner,body.animations-off .memory-front{animation:none;transition:none}
@media (prefers-reduced-motion:reduce){.memory-inner,.memory-front{animation:none;transition:none}}

/* The result: who found the most pairs, then everyone's places. */
.memory-result{display:grid;gap:14px}
.memory-result-hero{display:flex;align-items:center;gap:14px}
.memory-result-faces{display:flex;gap:6px}
.memory-result-face{display:block;width:64px;height:64px}
.memory-result-face svg,.memory-result-face .gh-face{display:block;width:100%;height:100%}
.memory-result-title{font-size:clamp(1.5rem,5vw,2.2rem)}
.memory-result-note{font-weight:700;color:var(--muted)}
.memory-order{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.memory-order li{display:grid;grid-template-columns:3em 34px 1fr auto;align-items:center;gap:10px;padding:6px 10px;border-radius:12px;background:#f4f1e6}
.memory-order li.memory-first{background:#f6e9c8}
.memory-order-place{font-weight:800}
.memory-order-face{display:block;width:34px;height:34px}
.memory-order-face svg,.memory-order-face .gh-face{display:block;width:100%;height:100%}
.memory-order-name{font-weight:700;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.memory-scores .score-table{margin-top:8px}

/* The TV: larger chips and type. */
@media (min-width:1100px) and (min-height:700px){.memory-chip{font-size:1rem}.memory-chip-face{width:36px;height:36px}.memory-left{font-size:.95rem}}
