/* Home only: one introduction, one clear create/join surface and a compact
 * selection of real games. Header,catalogue,rooms and playfields are owned
 * by their existing styles. No new imagery,fonts or animation payload. */
.home-welcome {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
  padding: 40px 12px 32px;
}
.home-welcome .hero-copy { max-width: 570px; }
.home-welcome h1 {
  margin: 0 0 20px;
  max-width: 15ch;
  font-size: clamp(38px, 4.3vw, 58px);
  line-height: 1.08;
  letter-spacing: -.025em;
}
.home-welcome h1 .pop { position: relative; color: var(--accent); white-space: nowrap; }
.home-welcome h1 .pop::after { content: ""; position: absolute; left: 2%; right: 4%; bottom: -.12em; height: .22em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cpath d='M3 9c30-7 58-7 88-2s64 6 106-4' fill='none' stroke='%23eab5c6' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
/* Fanned hand of game cards: tilted, overlapping, gently bobbing. */
.hero-hand { display: flex; align-items: flex-end; margin: 34px 0 6px 6px; height: 118px; }
.hand-card { --size: 96px; flex: none; width: var(--size); height: var(--size); margin-right: -20px; border-radius: 22px; overflow: hidden; background: var(--bg); border: 3px solid var(--bg); box-shadow: 0 10px 24px color-mix(in srgb, var(--ink) 16%, transparent); transform: translateY(calc(var(--d) * 7px)) rotate(calc(var(--i) * 8deg)); animation: hand-bob 3.6s ease-in-out infinite; animation-delay: calc(var(--i) * .35s); transition: transform .2s ease; }
.hand-card .hand-art { display: block; width: 100%; height: 100%; object-fit: cover; }
.hand-card:hover { transform: translateY(-12px) rotate(calc(var(--i) * 4deg)) scale(1.06); animation-play-state: paused; z-index: 1; }
@keyframes hand-bob { 50% { translate: 0 -6px; } }
.home-welcome .hero-sub { max-width: 43ch; margin-bottom: 18px; font-size: 17px; line-height: 1.6; font-weight: 500; }
.home-welcome .shelf-link { font-size: 16px; }
.home-welcome .hero-form {
  width: 100%;
  max-width: 420px;
  justify-self: end;
  padding: 24px;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: none;
}
.home-welcome .ticket-head { margin: 0 0 4px; }
.home-welcome .ticket-title { font-size: 24px; line-height: 1.2; }
.home-welcome .hero-form label { font-size: 14px; font-weight: 700; color: var(--ink-dim); }
.home-welcome .hero-form input { min-width: 0; min-height: 48px; border-radius: 11px; font-size: 16px; }
.home-welcome .hero-create-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.home-welcome .hero-cta .btn { min-height: 48px; padding-inline: 16px; border-radius: 11px; box-shadow: none; }
.home-welcome .ticket-or { display: block; margin: 14px 0 0; height: 10px; border-top: 1px solid var(--line); }
.home-welcome .ticket-or span { top: -13px; padding-inline: 10px; font-size: 13px; font-weight: 600; }
.home-welcome .ticket-or::before,
.home-welcome .ticket-or::after { display: none; }
.home-welcome .hero-joinrow { display: grid; grid-template-columns: minmax(184px, 1.15fr) minmax(0, .85fr); gap: 10px; }
.home-welcome .hero-joinrow input { max-width: none; width: 100%; letter-spacing: .12em; }
.home-welcome .hero-joinrow .btn { min-width: 0; min-height: 48px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--well); color: var(--ink); box-shadow: none; }
.home-welcome .ticket-note { margin: 2px 0 0; color: var(--ink-dim); font-size: 12px; line-height: 1.5; text-align: center; }
.home-welcome :is(button, a):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 900px) {
  .home-welcome { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 28px; padding-inline: 0; }
  .home-welcome h1 { font-size: 40px; }
}
@media (max-width: 640px) {
  .home-welcome { grid-template-columns: 1fr; gap: 24px; padding-top: 28px; padding-bottom: 20px; }
  .home-welcome h1 { max-width: 17ch; font-size: clamp(34px, 8.8vw, 42px); margin-bottom: 14px; }
  .home-welcome .hero-sub { font-size: 16px; margin-bottom: 4px; }
  .home-welcome .hero-form { justify-self: stretch; max-width: none; padding: 20px; }
}
@media (max-width: 380px) {
  .home-welcome h1 .pop { white-space: normal; }
  .home-welcome .hero-hand { height: 78px; }
  .home-welcome .hand-card { --size: 58px; margin-right: -12px; border-radius: 15px; border-width: 2px; }
  .home-welcome .hero-form { padding: 18px; }
  .home-welcome .hero-create-row { grid-template-columns: 1fr; }
  .home-welcome .ticket-title { font-size: 22px; }
}
@media (max-width: 640px) {
  .hero-hand { height: 92px; margin-top: 22px; }
  .hand-card { --size: 72px; margin-right: -16px; border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .hand-card { animation: none; transition: none; }
  .hand-card:hover { transform: translateY(calc(var(--d) * 7px)) rotate(calc(var(--i) * 8deg)); }
}

/* ---- Art-led home: big game art, a colour per category ---------------- */
[data-cat] { --cat: var(--accent); }
[data-cat="vote"] { --cat: #8b5cf6; }
[data-cat="draw"] { --cat: #f97316; }
[data-cat="social"] { --cat: #ec4899; }
[data-cat="bluff"] { --cat: #0ea5e9; }
[data-cat="word"] { --cat: #10b981; }
[data-cat="speed"] { --cat: #f59e0b; }
[data-cat="board"] { --cat: #6366f1; }
[data-cat="3d"] { --cat: #ef4444; }

/* The hand of cards is playable: hover fans it out, a tap opens the game. */
.hand-card { padding: 0; cursor: pointer; font: inherit; }
.hero-hand:hover .hand-card { transform: translateY(calc(var(--d) * 4px)) translateX(calc(var(--i) * 10px)) rotate(calc(var(--i) * 10deg)); }
.hero-hand .hand-card:hover { transform: translateY(-16px) translateX(calc(var(--i) * 10px)) rotate(calc(var(--i) * 4deg)) scale(1.1); z-index: 2; }
.hand-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (min-width: 641px) {
  .home-welcome .hand-card { --size: 112px; margin-right: -24px; border-radius: 24px; }
  .home-welcome .hero-hand { height: 136px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-hand:hover .hand-card, .hero-hand .hand-card:hover { transform: translateY(calc(var(--d) * 7px)) rotate(calc(var(--i) * 8deg)); }
}
:root { --stk: var(--outline); --ease-pop: cubic-bezier(0.22, 1, 0.36, 1); }
:root[data-theme="night"] { --stk: var(--outline); }
[data-theme="night"] body { --stk: var(--outline); }

/* The hand is dealt in, idles, and reacts: hover lifts a card with a wiggle
 * and its name; a press squashes it. Only transform and opacity move. */
.hero-hand { position: relative; }
.hand-card {
  position: relative; overflow: visible; background: var(--card);
  border: var(--outline-w-lg) solid var(--stk); box-shadow: 0 5px 0 var(--stk);
  animation: hand-deal .6s var(--ease-pop) backwards, hand-bob 3.6s ease-in-out infinite;
  animation-delay: calc(var(--n) * 70ms), calc(.7s + var(--i) * .35s);
  transition: transform .3s var(--ease-pop), scale .12s var(--ease-pop);
}
.hand-card .hand-art { border-radius: 16px; }
.hero-hand .hand-card:hover, .hero-hand .hand-card:focus-visible {
  animation: hand-deal .6s var(--ease-pop) backwards, hand-bob 3.6s ease-in-out infinite, hand-wiggle .5s var(--ease-pop);
  animation-delay: calc(var(--n) * 70ms), calc(.7s + var(--i) * .35s), 0s;
  animation-play-state: running;
}
.hand-card:active { scale: .94; }
.hand-tag {
  position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 3;
  padding: 4px 12px; border: 2px solid color-mix(in srgb, var(--sun) 72%, #000); border-radius: 999px;
  background: var(--sun); color: var(--sun-ink); font: 800 13px/1.2 var(--font-body); white-space: nowrap;
  opacity: 0; transform: translate(-50%, 4px) rotate(calc(var(--i) * -6deg)); pointer-events: none;
  transition: opacity .15s ease, transform .3s var(--ease-pop);
}
.hand-card:hover .hand-tag, .hand-card:focus-visible .hand-tag { opacity: 1; transform: translate(-50%, 0) rotate(calc(var(--i) * -6deg)); }
.hand-spark { position: absolute; z-index: 3; width: 22px; height: 22px; background: var(--sun); pointer-events: none;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: hand-twinkle 2.4s ease-in-out infinite; }
.hand-spark:nth-child(1) { left: -6px; top: 4px; }
.hand-spark:nth-child(2) { left: calc(var(--hand-w, 420px) - 24px); top: -6px; width: 16px; height: 16px; background: var(--teal); animation-delay: 1.2s; }
.hero-hand { --hand-w: 432px; }
@keyframes hand-deal { from { opacity: 0; translate: 0 48px; scale: .6; } }
@keyframes hand-wiggle { 30% { rotate: -6deg; } 60% { rotate: 4deg; } }
@keyframes hand-twinkle { 0%, 100% { opacity: .35; transform: scale(.6) rotate(0deg); } 50% { opacity: 1; transform: scale(1) rotate(20deg); } }

/* Create a room is the page's one big action: a sticker card, a fat button. */
.home-welcome .hero-form { border: var(--outline-w-lg) solid var(--stk); border-radius: 24px; box-shadow: var(--shadow-card); background: var(--card); }
.home-welcome .hero-create-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.home-welcome .hero-cta .hero-create {
  position: relative; width: 100%; min-height: 56px; border: var(--outline-w-lg) solid var(--stk); border-radius: 16px;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 74%, #000); font: 800 19px/1 var(--font-display);
  transition: transform var(--dur-quick) var(--ease);
}
.home-welcome .hero-create::after { content: "→"; display: inline-block; margin-left: 8px; transition: transform .2s var(--ease-pop); }
.home-welcome .hero-create:hover { transform: translateY(-2px); box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 74%, #000); }
.home-welcome .hero-create:hover::after { transform: translateX(4px); }
.home-welcome .hero-create:active { transform: translateY(var(--lift)); box-shadow: none; }
.home-welcome .hero-joinrow .btn { border: 2px solid var(--stk); }
/* One player trying out three seats. */
.pp-seats { grid-column: 1; grid-row: 1 / -1; position: relative; align-self: center; width: 100%; aspect-ratio: 1; border-radius: 14px; background: var(--card); }
.pp-seats i { --c: var(--sun); position: absolute; top: 34%; width: 30%; aspect-ratio: 1; border: 2px solid color-mix(in srgb, var(--c) 72%, #000); border-radius: 50%; background: var(--c); box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 72%, #000); }
.pp-seats i:nth-child(1) { --c: var(--teal); left: 6%; rotate: -10deg; }
.pp-seats i:nth-child(2) { --c: var(--accent); left: 35%; top: 22%; z-index: 1; }
.pp-seats i:nth-child(3) { right: 6%; rotate: 10deg; }

@media (max-width: 900px) {
  .pp-seats { width: 100%; margin-bottom: 8px; }
}
@media (max-width: 640px) {
  .hero-hand { --hand-w: 336px; }
}
@media (max-width: 380px) { .hero-hand { --hand-w: 262px; } }

/* ---- Lobby: a ticket with the code, players as seats ------------------- */
.partystrip:not(:has(.embedctx)) { border: var(--outline-w-lg) solid var(--stk); border-radius: 24px; box-shadow: 0 6px 0 var(--stk); padding: 16px 24px; gap: 16px 32px; margin-bottom: 8px; }
.partystrip .ps-ticket { position: relative; display: flex; align-items: stretch; flex: none; margin-bottom: 5px; border: 0; border-radius: 18px; box-shadow: none; }
.partystrip .ps-ticket .ps-codeblock { padding: 12px 20px; border-radius: 18px 0 0 18px; box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 70%, #000); }
.partystrip .ps-ticket .ps-codeblock::before, .partystrip .ps-ticket .ps-codeblock::after { display: none; }
.partystrip .ps-ticket .roomcode { font-size: 40px; letter-spacing: 6px; }
.partystrip .ps-ticket .bCopy {
  position: relative; min-height: 0; padding: 8px 20px; border: 0; border-radius: 0 18px 18px 0;
  box-shadow: 0 5px 0 var(--outline);
  background: var(--well); color: var(--ink); font: 800 16px/1.2 var(--font-body); max-width: 128px; white-space: normal;
  transition: transform var(--dur-quick) var(--ease);
}
/* The tear line is ticket art: a row of punched dots, not a border. */
.partystrip .ps-ticket .bCopy::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px;
  background: radial-gradient(circle, color-mix(in srgb, var(--ink-dim) 55%, var(--well)) 1.5px, transparent 2px) 0 0 / 3px 9px repeat-y; }
@media (hover: hover) { .partystrip .ps-ticket .bCopy:hover { background: var(--accent-soft); } }
.partystrip .ps-ticket .bCopy:active { transform: translateY(5px); box-shadow: none; }
.partystrip .ps-actions .btn, .partystrip .ps-actions summary { min-height: 44px; }
.partystrip .ps-actions #bLobbyLeave { border-color: var(--line); background: transparent; color: var(--ink-dim); }
.partystrip .ps-actions #bLobbyLeave:hover { color: var(--ink); }

.lobby-seats { gap: 12px 16px; margin-top: 12px; }
.partystrip .player.seat {
  position: relative; flex-direction: column; gap: 4px; width: 76px; padding: 0;
  border: 0; border-radius: 0; background: none; box-shadow: none; font-size: 14px; animation: none;
}
.partystrip .seat-av { position: relative; display: block; }
.partystrip .seat .avatar { width: 60px; height: 60px; font-size: 26px; border: 0; box-shadow: inset 0 -5px 0 #00000029, 0 3px 0 var(--stk); }
.partystrip .seat.is-host .avatar { outline: 3px solid var(--sun); outline-offset: 2px; }
.partystrip .seat-crown { position: absolute; top: -14px; left: 50%; width: 28px; height: 18px; margin-left: -14px; background: var(--sun); rotate: -8deg;
  clip-path: polygon(0 100%, 0 20%, 25% 60%, 50% 0, 75% 60%, 100% 20%, 100% 100%); }
.partystrip .seat-pts { position: absolute; right: -10px; bottom: -6px; padding: 0 6px; border: 2px solid var(--stk); border-radius: 999px; background: var(--card); color: var(--ink); font: 800 11px/1.5 var(--font-body); white-space: nowrap; }
.partystrip .seat-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.partystrip .seat .hosttag { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.partystrip .seat.off .seat-av { opacity: .5; }
@media (prefers-reduced-motion: no-preference) {
  .partystrip .seat.just-joined .seat-av { animation: seat-pop .6s var(--ease-pop); }
  .partystrip.pop .seat .seat-av { animation: seat-pop .6s var(--ease-pop) backwards; }
  .partystrip.pop .seat:nth-child(2) .seat-av { animation-delay: .08s; }
  .partystrip.pop .seat:nth-child(3) .seat-av { animation-delay: .16s; }
  .partystrip.pop .seat:nth-child(n+4) .seat-av { animation-delay: .24s; }
  @keyframes seat-pop { from { opacity: 0; transform: translateY(12px) scale(.6); } }
}
@media (max-width: 640px) {
  .partystrip:not(:has(.embedctx)) { padding: 16px; border-radius: 20px; }
  .partystrip .ps-ticket { width: 100%; }
  .partystrip .ps-ticket .ps-codeblock { flex: 1; display: block; width: auto; }
  .partystrip .ps-ticket .roomcode { font-size: 36px; }
  .partystrip .ps-actions { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
  .lobby-seats { gap: 12px; }
  .partystrip .player.seat { width: 68px; font-size: 13px; }
  .partystrip .seat .avatar { width: 52px; height: 52px; font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .hand-card, .hero-hand .hand-card:hover, .hero-hand .hand-card:focus-visible { animation: none; transition: none; }
  .hand-card:active { scale: none; }
  .hand-spark { animation: none; opacity: .8; }
  .hand-tag, .home-welcome .hero-create, .home-welcome .hero-create::after { transition: none; }
  .home-welcome .hero-create:hover, .home-welcome .hero-create:hover::after { transform: none; }
}
/* The lobby ticket already shows the code big; the header chip is for the game screen. */
#app:has(.partystrip .ps-ticket) .topbar .roomchip { display: none; }
/* Lobby confetti falls inside the room card only, behind its content. */
.partystrip:has(> .confetti--in) { position: relative; isolation: isolate; overflow: hidden; }
.partystrip:has(> .confetti--in) > :not(.confetti--in) { position: relative; z-index: 1; }
.confetti.confetti--in { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.confetti--in i { animation-name: fall-in; }
@keyframes fall-in { to { transform: translateY(260px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  @keyframes pick-deal { from { opacity: 0; transform: translateY(18px) rotate(-3deg) scale(.94); } }
  .hand-card:active { transform: scale(.96, .93); transition: transform .08s ease-out; }
}

/* Room code tiles: the real input sits on top, transparent, over 4 tiles. */
.hero-joinrow .code-tiles { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; min-width: 0; }
.hero-joinrow .code-tiles input { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; opacity: 0; z-index: 1; font-size: 16px; caret-color: transparent; cursor: text; }
.hero-joinrow .code-tile { display: grid; place-items: center; min-height: 48px; border-radius: 11px; background: var(--well); border: 2px solid var(--outline); font: 800 22px/1 var(--font-ui, inherit); color: var(--ink); transition: border-color .15s, transform .18s cubic-bezier(.34,1.56,.64,1); }
.hero-joinrow .code-tile:empty::before { content: ''; width: 10px; height: 3px; border-radius: 2px; background: var(--line-strong, currentColor); opacity: .45; }
.hero-joinrow .code-tile.filled { transform: translateY(-1px); }
.hero-joinrow .code-tile.on { border-color: var(--fam); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fam) 22%, transparent); }
.hero-joinrow .code-tiles.full .code-tile { border-color: color-mix(in srgb, var(--fam) 60%, var(--outline)); }
@media (prefers-reduced-motion: reduce) { .hero-joinrow .code-tile { transition: none; } }

/* Library entries share one link-sized row, with the illustration and the full title visible. */
.home-picks { padding: var(--space-24) 0 var(--space-32); }
.home-picks .sec-head { margin-bottom: var(--space-16); }
.home-picks .sec-head h2 { font: var(--text-heading); }
.home-picks .sec-head .muted { font: var(--text-caption); }
/* v2: every game is a cover tile. The cover art leads (it tells you the game), then the
 * name, a one-line pitch and the player count. Same component on home, shelf and room. */
.home-picks .pick-grid, #games .catalog-list, .grid-games, .feat-strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 24px 20px;
}
:is(.home-picks, #games, .grid-games, .feat-strip) .home-game-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  width: 100%; min-width: 0; min-height: 0; height: auto;
  margin: 0; padding: 0; text-align: left; text-decoration: none;
  border: 0; border-radius: 18px; background: transparent; color: var(--ink); box-shadow: none; transform: none;
  transition: transform var(--dur-quick) var(--ease);
}
.home-game-card::after { content: none; }
.home-game-card .home-card-art {
  display: block; width: 100%; min-width: 0; aspect-ratio: 5 / 4; border-radius: 16px; overflow: hidden; background: var(--well);
  box-shadow: 0 0 0 1px var(--line), 0 10px 24px -14px #000c;
  transition: box-shadow var(--dur-base) var(--ease);
}
.home-game-card .home-card-art :is(img, .art-fallback) {
  display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover;
  margin: 0; padding: 0; border: 0; border-radius: inherit; box-shadow: none;
  transition: transform var(--dur-slow) var(--ease);
}
/* Keep the shared text column aligned while letting each icon keep its own outline. */
.home-game-card .home-card-art:has(img[src$=".svg"]) { background: var(--well); }
.home-game-card .home-card-art img[src$=".svg"] { object-fit: contain; padding: 10%; border-radius: 0; background: transparent; }
.home-game-card .home-card-art [data-art-id="pocket-karts"] { object-position: 20% center; }
.home-game-card .home-card-art .art-fallback, .home-game-card .practice-art { display: grid; place-items: center; }
.home-game-card .practice-art { background: var(--fam-soft); color: var(--fam-deep); }
.home-game-card .home-card-copy { display: grid; gap: 2px; min-width: 0; padding: 0 2px; }
:is(.home-picks, #games, .grid-games, .feat-strip) .home-card-copy > span {
  display: block; min-height: 0; margin: 0; padding: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.home-game-card .home-card-copy .t { font: 800 17px/1.25 var(--font-display); color: var(--ink); }
.home-game-card .home-card-copy .d { font: 500 14px/1.35 var(--font-body); color: var(--ink-dim); }
.home-game-card .home-card-copy .p { font: 600 12px/1.4 var(--font-body); color: var(--ink-dim); }
:is(.home-picks, #games, .grid-games, .feat-strip) .home-card-copy .communication-hint { white-space: normal; }
.home-game-card:focus-visible { outline: var(--focus-ring); outline-offset: 4px; }
@media (hover: hover) {
  :is(.home-picks, #games, .grid-games, .feat-strip) .home-game-card:hover { transform: translateY(-3px); }
  .home-game-card:hover .home-card-art { box-shadow: 0 0 0 1px color-mix(in srgb, var(--fam) 55%, transparent), 0 18px 34px -16px color-mix(in srgb, var(--fam) 60%, #000); }
  .home-game-card:hover .home-card-art :is(img, .art-fallback) { transform: scale(1.04); }
}
:is(.home-picks, #games, .grid-games, .feat-strip) .home-game-card:active { transform: scale(.98); }
@media (max-width: 699px) {
  .home-picks .pick-grid, #games .catalog-list, .grid-games, .feat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .home-game-card .home-card-copy .t { font-size: 15px; }
  .home-game-card .home-card-copy .d { display: none; }
}
@media (prefers-reduced-motion: reduce) { .home-game-card, .home-game-card * { transition: none !important; } }

/* One-device play sits beside room creation in the same entry ticket. */
.home-welcome .hero-local { display: flex; width: 100%; min-height: var(--control-h); margin-top: var(--space-12); font: var(--text-button); }

/* Night lobby: a quiet surface around the illustrated game art. */
[data-theme="night"] .home-welcome .hero-form {
  border:1px solid var(--edge);
  border-radius:16px;
  box-shadow:0 8px 20px #0003;
}
[data-theme="night"] .home-welcome h1 .pop::after,
.hand-spark { display:none; }
[data-theme="night"] .home-welcome .hero-cta .hero-create,
[data-theme="night"] .home-welcome .hero-local {
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow:none;
}
.hero-hand .hand-card,
.hero-hand:hover .hand-card,
.hero-hand .hand-card:is(:hover,:focus-visible) {
  animation:none;
  translate:none;
  transform:rotate(calc(var(--i) * 3deg));
  border:1px solid var(--edge);
  box-shadow:0 2px 6px #0002;
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  .hero-hand .hand-card:is(:hover,:focus-visible) { transform:translateY(-4px); }
}

/* Both Giggle apps have a direct entry from the public game shelf. */
.home-app-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px 24px; }
.home-app-actions a { min-height:44px; display:inline-flex; align-items:center; gap:9px; }
.home-meet-link { font:650 14px/1.4 var(--font-body); color:var(--ink-dim); text-decoration:none; }
.home-meet-link:hover { color:var(--ink); }
.home-meet-link:focus-visible { outline:var(--focus-ring); outline-offset:4px; border-radius:4px; }

/* ===== v3 home: sidebar + main (approved mockup) ===== */
.app:has(.home-shell) { max-width: 1320px; }
.home-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-24); align-items: start; padding-top: var(--space-16); }
.home-side { position: sticky; top: calc(var(--space-16) + 64px); display: grid; gap: var(--space-16); padding: var(--space-12); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
.side-nav { display: grid; gap: 2px; }
.side-link { display: flex; align-items: center; gap: var(--space-12); min-height: 44px; padding: 0 var(--space-12); border-radius: var(--radius-md); color: var(--ink-dim); font: 600 15px/1.2 var(--font-body); text-decoration: none; transition: background-color .16s ease-out, color .16s ease-out; }
.side-link .game-ui-icon { flex: none; opacity: .9; }
.side-link.is-on { background: var(--accent-soft); color: var(--accent-deep); }
[data-theme="night"] .side-link.is-on { color: var(--ink); }
.side-link.is-on .game-ui-icon { color: var(--accent); }
@media (hover: hover) { .side-link:not(.is-on):hover { background: var(--well); color: var(--ink); } }
.side-link:active { scale: .98; }
.side-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.side-note { margin: 0; padding: var(--space-12) var(--space-12) var(--space-4); border-top: 1px solid var(--line); color: var(--ink-dim); font: var(--text-caption); }
.home-main { display: grid; gap: var(--space-32); min-width: 0; }

/* Start panel: copy and create/join on the left, a fanned hand of covers on the right. */
.home-shell .home-welcome { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: var(--space-24); align-items: center; margin: 0; padding: clamp(20px, 3vw, 36px); border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--card); }
.home-shell .home-welcome .hero-copy { max-width: 560px; }
.home-shell .home-welcome h1 { margin: 0 0 var(--space-12); font: 800 clamp(32px, 3.6vw, 46px)/1.05 var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
.home-shell .home-welcome .hero-sub { margin: 0 0 var(--space-24); max-width: 46ch; color: var(--ink-dim); font: 500 16px/1.55 var(--font-body); }
.start-form { display: grid; gap: var(--space-8); }
.start-form > label { color: var(--ink-dim); font: var(--text-caption); }
.home-shell .hero-create-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-8); }
.home-shell .hero-create-row input { min-height: 48px; border-radius: var(--radius-md); }
.home-shell .hero-cta .btn { min-height: 48px; padding-inline: var(--space-24); border-radius: var(--radius-md); }
.hero-stage { display: grid; place-items: center; min-width: 0; }

.home-shell .band { margin: 0; padding: 0; }
.home-shell .sec-head { display: flex; align-items: baseline; gap: var(--space-12); margin: 0 0 var(--space-16); }
.home-shell .sec-head h2 { margin: 0; font: 800 24px/1.2 var(--font-display); }
.home-shell .sec-link { margin-left: auto; color: var(--ink-dim); font: var(--text-button-sm); text-decoration: none; }
@media (hover: hover) { .home-shell .sec-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; } }
:is(.home-shell, .lobby) .catbar #hq { min-height: 44px; border-radius: var(--radius-pill); padding-inline: var(--space-16); }

@media (max-width: 1023px) {
  .home-shell { grid-template-columns: minmax(0, 1fr); gap: var(--space-16); }
  .home-side { position: static; order: 2; padding: var(--space-8); }
  .side-nav { display: flex; gap: var(--space-4); overflow-x: auto; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-link { flex: none; min-height: 40px; }
  .side-note { display: none; }
  .home-main { display: contents; }
  .home-shell .home-welcome { order: 1; }
  .home-shell .home-picks { order: 3; }
  .home-shell #games { order: 4; }
}
@media (max-width: 720px) {
  .home-shell .home-welcome { grid-template-columns: minmax(0, 1fr); padding: var(--space-16); }
  .hero-stage { order: -1; }
}

/* Filters: neutral segmented pickers and chips; the selection is an ink fill, never a pink outline. */
:is(.home-shell, .lobby) .catbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); }
:is(.home-shell, .lobby) .catbar #hq { flex: 1 1 220px; max-width: 320px; }
:is(.home-shell, .lobby) .catbar .picker-seg.tb-seg { gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--card); box-shadow: none; }
:is(.home-shell, .lobby) .catbar .picker-seg.tb-seg > button { min-height: 36px; padding: 0 var(--space-12); border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-dim); box-shadow: none; font: 600 14px/1 var(--font-body); transition: background-color .16s ease-out, color .16s ease-out; }
:is(.home-shell, .lobby) .catbar .picker-seg.tb-seg > button:is([aria-checked="true"], [aria-pressed="true"], .is-selected) { border: 0; background: var(--ink); color: var(--bg); box-shadow: none; }
:is(.home-shell, .lobby) :is(.catbar, .catchips) .chip { min-height: 36px; padding: 0 var(--space-12); border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--card); color: var(--ink-dim); box-shadow: none; font: 600 14px/1 var(--font-body); transition: background-color .16s ease-out, color .16s ease-out, border-color .16s ease-out; }
:is(.home-shell, .lobby) :is(.catbar, .catchips) .chip.sel { border-color: var(--ink); background: var(--ink); color: var(--bg); }
@media (hover: hover) {
  :is(.home-shell, .lobby) .catbar .picker-seg.tb-seg > button:not([aria-checked="true"]):hover { color: var(--ink); background: var(--well); }
  :is(.home-shell, .lobby) :is(.catbar, .catchips) .chip:not(.sel):hover { color: var(--ink); border-color: var(--line-strong); background: var(--card); }
}
:is(.home-shell, .lobby) :is(.catbar, .catchips) :is(.chip, .picker-seg > button):active { scale: .96; }
:is(.home-shell, .lobby) .catchips { display: flex; flex-wrap: wrap; gap: var(--space-8); margin: var(--space-12) 0 var(--space-16); }
:is(.home-shell, .lobby) .count-pill { padding: 3px 10px; border: 0; border-radius: var(--radius-pill); background: var(--well); color: var(--ink-dim); font: var(--text-caption); }
@media (max-width: 520px) { .home-shell .hero-create-row { grid-template-columns: minmax(0, 1fr); } .home-shell .hero-cta .btn { width: 100%; } }

/* Room lobby on laptops: the room ticket and players stay in a left column; games fill the right. */
@media (min-width: 1100px) {
  .app:has(> .lobby) { max-width: 1320px; }
  .lobby { display: grid; grid-template-columns: 340px minmax(0, 1fr); column-gap: var(--space-24); align-items: start; }
  .lobby > .partystrip { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 76px; margin: 0; }
  .lobby > section:not(.partystrip) { grid-column: 2; min-width: 0; }
  .lobby > .partystrip :is(.party-top, .party-row, .party-head) { flex-wrap: wrap; }
}
@media (min-width: 1100px) {
  .lobby > .partystrip .room-visibility { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--space-8); align-items: center; }
  .lobby > .partystrip .room-visibility > :is(legend, p) { grid-column: 1 / -1; }
  .lobby > .partystrip .room-visibility label { min-height: 40px; margin: 0; }
}
.side-out { margin-left: auto; color: var(--ink-dim); font-size: 13px; }

/* Start panel v3.1: a contained three-cover stack and a one-line join row. */
.home-shell .home-welcome { grid-template-columns: minmax(300px, 1fr) minmax(180px, 360px); gap: clamp(20px, 3vw, 48px); }
.hero-stage { display: grid; place-items: center; min-width: 0; }
.cover-stack { position: relative; width: 100%; max-width: 380px; aspect-ratio: 1.15; }
.stack-card { position: absolute; top: 12%; width: 58%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 22px; background: var(--well); box-shadow: 0 1px 0 #ffffff14 inset, 0 14px 30px #0d0b1440; cursor: pointer; transition: translate .3s var(--ease), rotate .3s var(--ease), scale .3s var(--ease); }
[data-theme="night"] .stack-card { box-shadow: 0 14px 34px #00000080; }
.stack-card .stack-art { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.stack-card:nth-child(1) { left: 0; rotate: -9deg; z-index: 1; }
.stack-card:nth-child(2) { left: 21%; top: 0; z-index: 3; }
.stack-card:nth-child(3) { right: 0; rotate: 9deg; z-index: 2; }
.stack-name { position: absolute; left: 50%; bottom: -14px; translate: -50% 0; padding: 5px 10px; border-radius: var(--radius-pill); background: var(--ink); color: var(--bg); font: 700 12px/1 var(--font-body); white-space: nowrap; opacity: 0; transition: opacity .2s ease-out; pointer-events: none; }
.stack-card:is(:hover, :focus-visible) .stack-name { opacity: 1; }
.stack-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  @media (hover: hover) {
    .cover-stack:hover .stack-card:nth-child(1) { translate: -10px 4px; rotate: -13deg; }
    .cover-stack:hover .stack-card:nth-child(3) { translate: 10px 4px; rotate: 13deg; }
    .cover-stack .stack-card:hover { translate: 0 -10px; scale: 1.04; z-index: 4; }
  }
  .stack-card:active { scale: .96; }
}
/* Join with a code: one quiet line under Create. */
.home-shell .start-form .join-row { display: grid; grid-template-columns: minmax(176px, 232px) auto; justify-content: start; align-items: center; gap: var(--space-12); margin-top: var(--space-8); padding-top: var(--space-16); border-top: 1px solid var(--line); }
.home-shell .join-row > label { grid-column: 1 / -1; color: var(--ink-dim); font: var(--text-caption); }
.home-shell .join-row .code-tiles { width: 100%; gap: 6px; }
.home-shell .join-row .code-tile { min-height: 44px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--well); font: 800 20px/1 var(--font-display); }
.home-shell .join-row .code-tile.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.home-shell .join-row #bJoin { min-height: 44px; padding-inline: var(--space-16); }
@media (max-width: 860px) {
  .home-shell .home-welcome { grid-template-columns: minmax(0, 1fr); }
  .hero-stage { order: -1; }
  .cover-stack { max-width: 280px; }
}
@media (max-width: 460px) {
  .home-shell .start-form .join-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cover-stack { max-width: 230px; }
}
/* Phones get the short version: one-line pitch, name placeholder instead of a visible label,
   smaller heading and cover stack so Create room sits above the fold. */
.hero-sub-short { display: none; }
@media (max-width: 560px) {
  .home-shell .home-welcome .hero-sub-long { display: none; }
  .home-shell .home-welcome .hero-sub-short { display: block; margin-bottom: var(--space-16); font-size: 15px; }
  .home-shell .home-welcome h1 { font-size: 30px; margin-bottom: var(--space-8); }
  .home-shell .start-form > label[for="nm"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .home-shell .home-welcome { gap: var(--space-12); }
  .cover-stack { max-width: 190px; }
  .stack-card { border-radius: 16px; box-shadow: 0 6px 14px #1b14201f; }
  [data-theme="night"] .stack-card { box-shadow: 0 8px 18px #00000066; }
  .home-shell .start-form .join-row { margin-top: var(--space-4); padding-top: var(--space-12); }
}
@media (max-width: 380px) {
  .home-shell .start-form .join-row { grid-template-columns: minmax(0, 1fr); }
  .home-shell .join-row #bJoin { width: 100%; }
  .home-shell .home-welcome h1 { font-size: 26px; }
}
/* Sidebar: one line per item, external link marked quietly, no extra note. */
.side-link span:not(.side-out) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-link .side-out { margin-left: auto; color: var(--ink-dim); font-size: 13px; }
.home-side { gap: 0; }

/* Browse all: a little stack of covers that fans out, and a chevron that nudges. */
.home-shell .browse-wrap { display: flex; justify-content: center; margin-top: var(--space-24); }
.browse-btn { gap: var(--space-12); min-height: 52px; padding: 6px 18px 6px 10px; border-radius: var(--radius-pill); }
.browse-stack { position: relative; display: inline-block; width: 64px; height: 36px; }
.browse-stack .browse-art { position: absolute; top: 2px; left: 14px; width: 32px; height: 32px; border-radius: 9px; object-fit: cover; box-shadow: 0 2px 6px #0d0b1433; transition: translate .3s var(--ease), rotate .3s var(--ease); }
.browse-stack .browse-art:nth-child(1) { rotate: -12deg; translate: -10px 2px; }
.browse-stack .browse-art:nth-child(3) { rotate: 12deg; translate: 10px 2px; }
.browse-chev { transition: rotate .3s var(--ease); }
.browse-btn.is-open .browse-chev { rotate: 180deg; }
@media (prefers-reduced-motion: no-preference) {
  @media (hover: hover) {
    .browse-btn:hover .browse-art:nth-child(1) { translate: -18px 0; rotate: -20deg; }
    .browse-btn:hover .browse-art:nth-child(2) { translate: 0 -4px; }
    .browse-btn:hover .browse-art:nth-child(3) { translate: 18px 0; rotate: 20deg; }
    .browse-btn:not(.is-open):hover .browse-chev { animation: chev-nudge .9s ease-in-out infinite; }
  }
  @keyframes chev-nudge { 0%, 100% { translate: 0 0; } 50% { translate: 0 3px; } }
}

/* Giggle Meet promo: the friend-groups illustration and one clear action. */
.meet-promo { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-24); margin-top: var(--space-32); padding: var(--space-16) var(--space-24); border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--card); color: var(--ink); text-decoration: none; transition: border-color .16s ease-out, background-color .16s ease-out; }
.meet-promo-art { width: 112px; height: 112px; object-fit: contain; transition: rotate .4s var(--ease), scale .4s var(--ease); }
.meet-promo-copy { display: grid; gap: 4px; min-width: 0; }
.meet-promo-copy b { font: 800 20px/1.2 var(--font-display); }
.meet-promo-copy small { color: var(--ink-dim); font: 500 14px/1.5 var(--font-body); }
.meet-promo-cta { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-md); background: var(--accent); color: #fff; font: var(--text-button-sm); white-space: nowrap; transition: background-color .16s ease-out; }
.meet-promo:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) {
  .meet-promo:hover { border-color: var(--line-strong); }
  .meet-promo:hover .meet-promo-cta { background: color-mix(in srgb, var(--accent) 86%, #fff); }
}
@media (prefers-reduced-motion: no-preference) {
  @media (hover: hover) { .meet-promo:hover .meet-promo-art { rotate: -4deg; scale: 1.06; } }
  .meet-promo:active { scale: .99; }
}
@media (max-width: 640px) {
  .meet-promo { grid-template-columns: 72px minmax(0, 1fr); gap: var(--space-12); padding: var(--space-12) var(--space-16); }
  .meet-promo-art { width: 72px; height: 72px; }
  .meet-promo-copy b { font-size: 17px; }
  .meet-promo-cta { grid-column: 1 / -1; justify-content: center; }
}

/* Filters: inline on laptops; behind one Filters button on phones. Categories swipe in one row. */
.home-filters { display: contents; }
.filter-toggle { display: none; }
@media (max-width: 720px) {
  :is(.home-shell, .lobby) .catbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-8); }
  :is(.home-shell, .lobby) .catbar #hq { max-width: none; width: 100%; }
  .filter-toggle { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px !important; padding: 0 14px !important; }
  .filter-toggle .filter-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
  .home-filters { display: none; grid-column: 1 / -1; flex-direction: column; gap: var(--space-8); padding: var(--space-12); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
  .home-filters.is-open { display: flex; }
  .home-filters .catpick, .home-filters .picker-seg { width: 100%; }
  .home-filters #hcustTog { align-self: flex-start; }
  :is(.home-shell, .lobby) .catchips { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; margin-inline: 0; padding-inline: 0; }
  :is(.home-shell, .lobby) .catchips::-webkit-scrollbar { display: none; }
  :is(.home-shell, .lobby) .catchips .chip { flex: none; scroll-snap-align: start; }
}
@media (prefers-reduced-motion: no-preference) {
  .home-filters.is-open { animation: filters-in .22s ease-out; }
  @keyframes filters-in { from { opacity: 0; translate: 0 -6px; } }
}

/* Use the width: as many columns as fit a comfortable cover, from small phones to wide laptops. */
:is(.home-shell, .lobby) :is(#games .catalog-list, .grid-games) { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.home-shell .home-picks .pick-grid { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
@media (max-width: 1023px) {
  :is(.home-shell, .lobby) :is(#games .catalog-list, .grid-games), .home-shell .home-picks .pick-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 18px 12px; }
}
@media (max-width: 359px) {
  :is(.home-shell, .lobby) :is(#games .catalog-list, .grid-games), .home-shell .home-picks .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Picks on phones become one swipeable row instead of two big rows. */
@media (max-width: 699px) {
  .home-shell .home-picks .pick-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 12px; margin-inline: 0; padding-inline: 0; }
  .home-shell .home-picks .pick-grid::-webkit-scrollbar { display: none; }
  .home-shell .home-picks .pick-grid > * { flex: 0 0 42%; scroll-snap-align: start; }
}
