/* JoyFlock home — shared near-black backdrop.
   Loaded after portal.css. Rules are scoped to #home or body:not(.playing)
   so the in-game #play view keeps its original layout and sizing. */

:root{
  /* The lobby now uses exactly the same backdrop as the info pages
     (membership / terms / privacy / contact): one near-black base from
     legal.css / portal.css, with the shared ambient nebula on top. Only the
     lobby's own surfaces (cards, pills) stay lifted above it. */
  --home-bg:#0b1020;
  --home-bg-top:#0b1020;
  --home-bg-bottom:#0b1020;
  --home-surface:#283357;
  --home-line:#ffffff1f;
  --home-text:#f6f7ff;
  --home-muted:#b6c2de;
  --home-dim:#9dabd0;
  --home-accent:#bccaff;
}

/* Shared chrome height comes from --chrome-height in site-chrome.css;
   #play subtracts the same variable so the game stage always fills the shell. */
/* Viewport shell: header stays put, #home scrolls, footer is always visible. */
html,body{height:100%}
body{
  height:100dvh;min-height:0;margin:0;
  display:flex;flex-direction:column;overflow:hidden;
  /* No page-specific overrides: --chrome-fade, --ambient-nebula-opacity and
     --ambient-star-opacity all keep their site-wide defaults, so the footer
     fade and nebula match the info pages frame for frame. */
  background:var(--home-bg);
  color:var(--home-text);
}
.topbar{
  flex:0 0 auto;position:static;
  border-bottom:1px solid #ffffff0c;background:#0b1020;gap:52px;
}
.brand{font:900 29px Nunito,system-ui;letter-spacing:-1px}
.brand-mark{color:#a8b8ff;margin-right:9px;font-size:inherit}
.topbar nav a{
  padding:0 14px;border-radius:9px;
  color:#94a0be;font-size:14px;font-weight:700;
}
.topbar nav a:hover{color:#e7eeff;background:#ffffff0a}
.topbar nav .active,.topbar nav a.active{
  color:#fff;border-bottom:0;background:#1b254a;
}
.top-note{color:#8390b0;font-size:13px;font-family:inherit;letter-spacing:normal;text-transform:none}
body:not(.playing) .top-note{display:none}
body:not(.playing) .portal-language{margin-left:auto;flex:0 0 auto;min-width:96px;max-width:none}
.portal-language{
  font:inherit;font-size:13px;font-weight:700;color:#e3eaff;
  background:#1b254a;border:1px solid #46518a;border-radius:10px;padding:8px 10px;
}
.portal-language:focus-visible{outline:2px solid #a8b8ff;outline-offset:3px}
.portal-controls button{
  border:1px solid #465580;border-radius:11px;
  background:linear-gradient(#293659,#1b2542);box-shadow:0 3px 0 #080d20;
  color:#e7eeff;font-weight:700;min-height:38px;padding:7px 14px;
}
.account{border:1px solid #46518a;border-radius:11px;padding:10px 17px;background:#1b254a;font-size:13px;font-weight:700}

#home{
  flex:1 1 auto;min-height:0;width:100%;
  max-width:1180px;padding:0 32px 28px;margin:0 auto;
  overflow-y:auto;overscroll-behavior:contain;position:static;
  scrollbar-width:thin;scrollbar-color:#3b4878 transparent;
}
#home::-webkit-scrollbar{width:10px}
#home::-webkit-scrollbar-track{background:transparent}
#home::-webkit-scrollbar-thumb{background:#3b4878;border:3px solid var(--home-bg);border-radius:10px}

/* Hero: one line of type, one line of explanation, one status pill. */
#home .intro{padding:40px 0 22px;border:0}
#home .intro h1{
  margin:0 0 14px;font-size:clamp(28px,3.1vw,42px);
  line-height:1.28;letter-spacing:-1px;font-weight:800;color:var(--home-text);
}
#home .intro h1>span{display:inline;color:var(--home-text);font-family:inherit;font-weight:inherit;letter-spacing:inherit}
#home .intro h1>span:last-child{color:var(--home-accent)}
#home .intro p{
  max-width:40em;margin:0;color:#b3c0de;font-size:14px;line-height:1.8;
}
.hero-status{
  display:inline-flex;align-items:center;gap:8px;margin-top:18px;
  padding:7px 14px;border:1px solid #6a7ccc;border-radius:20px;
  background:#2c3a72;color:#e2e9ff;font-size:12px;font-weight:700;
}
.hero-status i{
  width:7px;height:7px;border-radius:50%;background:#81e3b1;
  box-shadow:0 0 10px #81e3b160;flex:0 0 auto;
}

/* Section heading: plain and factual, no eyebrow or capsule. */
#home .home-layout{display:block;margin:0;padding:0}
#home .library{margin:0;padding:14px 0 0}
#home .section-heading{
  display:flex;align-items:baseline;justify-content:space-between;
  margin:0 0 16px;padding:0;border:0;
}
#home .section-heading h2{margin:0;font-size:18px;font-weight:800;color:var(--home-text)}
#home .section-heading p{margin:6px 0 0;font-size:12px;color:var(--home-dim)}
#home .section-heading .count{
  margin-left:auto;border:0;padding:0;border-radius:0;background:none;
  font-size:12px;color:var(--home-dim);letter-spacing:normal;text-transform:none;font-family:inherit;
}

/* Dense square-cover grid, like a straightforward game lobby. */
#home .cards{
  display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px;
  background:none;border:0;counter-reset:none;
  /* The caption is a separate row BELOW the cover now, so the hover CTA is
     centred on the artwork itself instead of the old squashed square card. */
  --card-caption-half:0px;
}
#home .cards .game-card{
  position:relative;display:flex;flex-direction:column;
  overflow:hidden;counter-increment:none;
  border:1px solid var(--home-line);border-radius:12px;background:var(--home-surface);
  transition:transform .18s,border-color .18s,background .18s,box-shadow .18s;
}
#home .cards .game-card.live:hover{
  /* Do NOT transform the card itself. Moving its hit box up by 3px drops a
     pointer resting near the bottom edge, which cancels :hover, snaps the
     card back, re-enters ... a visible flicker plus a repeated zoom sound.
     A soft shadow gives the lifted feel without changing hit-testing, and
     transform:none also blocks portal.css's older scale(1.05) fallback. */
  transform:none;z-index:1;background:#323e6d;
  box-shadow:0 8px 22px #00000066;
}
/* The cover keeps its FULL square: the black caption row is below it, so
   object-fit no longer crops the bottom of the artwork. */
#home .cards .card-art{
  position:relative;aspect-ratio:1/1;flex:0 0 auto;
  display:grid;place-items:center;
  overflow:hidden;border-radius:0;isolation:isolate;
}
/* The old decorative ring from portal.css stays off. ::after is repurposed as
   a soft darkening veil that only appears while the card is hovered, so the
   play prompt stays legible on both pale and busy covers. It also blurs its
   backdrop: the veil sits above the artwork (and the blue card's CSS sky)
   but BELOW .card-label (z-index:2), so the cover softens on hover while
   "Play now" stays razor sharp. Blurring the veil instead of <img> keeps
   the existing scale and the blue card's drop-shadow untouched. */
#home .cards .card-art:before{display:none}
#home .cards .card-art::after{
  content:'';position:absolute;inset:0;z-index:1;
  background:linear-gradient(180deg,#060a1826 0%,#060a1852 52%,#060a18b3 100%);
  -webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);
  opacity:0;transition:opacity .24s ease;pointer-events:none;
}
#home .cards .game-card.live:hover .card-art::after,
#home .cards .game-card.live:focus-visible .card-art::after{opacity:1}
#home .cards .card-art img{
  width:100%;height:100%;object-fit:cover;border-radius:0;
  filter:none;transform:none;transition:transform .25s;
}
#home .cards .game-card.blue .card-art img{
  width:94%;height:94%;object-fit:contain;filter:drop-shadow(0 10px 8px #1d51854d);
}
#home .cards .game-card.live:hover .card-art img{transform:scale(1.05)}
#home .cards .game-card.blue.live:hover .card-art img{transform:scale(1.03)}
/* Hover-only call to action. The reference site slaps a big orange button
   over the caption; ours is a compact deep-blue glass pill centred on the
   WHOLE card (cover + black caption row), so the game title below stays
   visible. Locale text comes from the existing .lang-en / .lang-cn spans. */
#home .cards .card-label{
  position:absolute;z-index:2;left:50%;bottom:auto;
  top:calc(50% + var(--card-caption-half,0px));
  display:inline-flex;align-items:center;justify-content:center;
  min-width:128px;padding:10px 20px;border-radius:999px;
  background:linear-gradient(135deg,#3b5bd9 0%,#263f9e 100%);
  border:1px solid #8ea3ff;
  box-shadow:0 8px 20px #050a1ccc,inset 0 1px 0 #ffffff3d,0 0 0 4px #6f8bff1a;
  color:#fff;font:800 14px/1.2 Nunito,system-ui,sans-serif;
  letter-spacing:.4px;white-space:nowrap;
  backdrop-filter:blur(6px);pointer-events:none;
  opacity:0;transform:translate(-50%,calc(-50% + 10px)) scale(.96);
  transition:opacity .24s ease,transform .24s cubic-bezier(.2,.8,.2,1);
}
#home .cards .game-card.live:hover .card-label,
#home .cards .game-card.live:focus-visible .card-label{
  opacity:1;transform:translate(-50%,-50%) scale(1);
}
/* The CJK fallback font draws its glyphs ~1.5px above the optical centre of
   the line box (English "Play now" is already centred within 0.3px). Nudge
   only the Chinese label so the ink, not just the line box, sits centred in
   the pill; transform keeps the pill's size and hit box untouched. */
#home .cards .card-label .lang-cn{transform:translateY(1.5px)}
/* Keep ONE caption row per card: just the game name. No arrow, no underline —
   the cover and the name are enough. The small grey description line
   ("2人 · 休闲台球") is intentionally gone too, and the p guard also
   neutralises an older cached script that might still inject it. */
/* Caption bar sits BELOW the full square cover (no longer eats into it). */
#home .card-copy{
  display:flex;align-items:center;flex:0 0 auto;
  min-height:54px;padding:0 6px;border-top:1px solid #ffffff12;
  background:#000;
}
/* Card captions start at the same muted blue-grey as the header links
   (--chrome-muted), then brighten to full white on hover/focus. Only colour
   and glow animate: no letter-spacing / font-size changes, so switching
   locale or hovering never shifts the text. */
#home .card-copy h3{
  display:flex;align-items:center;justify-content:center;gap:8px;
  width:100%;min-width:0;margin:0;
  color:var(--chrome-muted,#94a0be);font-size:22.5px;font-weight:800;letter-spacing:.1px;
  transition:color .22s ease,text-shadow .22s ease;
}
#home .card-copy .game-card-title{
  min-width:0;max-width:100%;color:inherit;text-align:center;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
/* portal.css colours every span inside h3 muted; the two locale spans must
   inherit the caption colour instead of the old grey. */
#home .card-copy .game-card-title>span{color:inherit}
#home .cards .game-card.live:hover .card-copy h3,
#home .cards .game-card.live:focus-visible .card-copy h3{
  color:var(--home-text);text-shadow:0 0 14px #bccaff66;
}
#home .card-copy p{display:none!important}

/* Colophon: pinned to the bottom of the viewport, never in the scroll area. */
body>footer{
  position:relative;z-index:2;
  flex:0 0 auto;display:flex;align-items:center;gap:14px;
  width:min(1180px,100%);margin:0 auto;padding:7px 32px;
  border-top:1px solid #ffffff1a;background:#0e1428;
  box-shadow:0 -10px 30px #00000055;
  color:#6f7d9c;font-family:inherit;font-size:10px;
  letter-spacing:normal;text-transform:none;
}
/* Content slides softly under the fixed bar instead of being cut abruptly. */
body>footer::before{
  content:'';position:absolute;left:0;right:0;bottom:100%;height:16px;
  background:linear-gradient(transparent,var(--home-bg-bottom));
  pointer-events:none;
}
body>footer .brand{font:900 15px Nunito,system-ui;letter-spacing:-1px;color:#a4b1d4}
body>footer span{margin-left:6px}
body>footer div{margin-left:auto;gap:14px}
body>footer div a:hover{color:var(--home-accent)}
body.playing>footer{display:none}

@media(max-width:1050px){
  #home{padding:0 24px 24px}
  body>footer{padding:7px 24px}
  #home .intro{padding:34px 0 22px}
  #home .cards{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media(max-width:760px){
  #home .cards{grid-template-columns:repeat(3,minmax(0,1fr))}
  #home .intro h1{font-size:30px;letter-spacing:-.5px}
}
@media(max-width:600px){
  .topbar nav a,.topbar nav a:last-child{display:inline-flex;padding:0 9px}
  body:not(.playing) .topbar{gap:10px;padding:0 12px}
  body:not(.playing) .portal-language{min-width:84px;font-size:11px;padding:6px}
}
@media(max-width:520px){
  #home{padding:0 16px 20px}
  body>footer{padding:8px 16px;flex-wrap:wrap;gap:8px}
  body>footer span{margin-left:0;width:100%}
  body>footer div{margin-left:0;width:100%}
  #home .cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  #home .card-copy{padding:0 6px;min-height:54px}
  #home .card-copy h3{font-size:19.5px}
  #home .cards .card-label{min-width:112px;padding:9px 16px;font-size:13px}
  #home .section-heading p{display:none}
}
/* The 600px rule above outranks site-chrome.css and kept a 12px right
   padding on the lobby home, pushing the cluster 9px off a 390px screen.
   The lobby nav is wider than the in-game header, so keep 2px less than
   the 4px shell padding to fit the signed-in cluster without overflow. */
@media(max-width:480px){
  body:not(.playing) .topbar{gap:2px;padding:0 2px}
}
@media(prefers-reduced-motion:reduce){
  #home .cards .game-card,#home .cards .card-art img,
  #home .cards .card-art::after,#home .cards .card-label,
  #home .card-copy h3,
  #home .card-copy .game-card-title{transition:none}
}

/* Matchmaking notice: owned by the portal, so it can sit at the very top of
   the viewport (above the header). State comes from joyflock:match messages. */
body>.portal-match-box{
  position:fixed!important;top:0!important;left:50%;transform:translateX(-50%);
  z-index:2147483000;display:flex;align-items:center;gap:9px;
  width:max-content;max-width:calc(100% - 24px);min-width:230px;
  padding:8px 11px 9px;border-radius:0 0 10px 10px;
  background:linear-gradient(135deg,#3b5bd9,#263f9e);
  border:1px solid #6f8bff;border-top:0;color:#fff;
  box-shadow:0 10px 26px #0008,inset 0 -1px 0 #ffffff24;
  font:600 12px/1.25 system-ui,sans-serif;
  animation:pm-in .25s ease-out;
}
body>.portal-match-box[hidden]{display:none!important}
.pm-spinner{
  flex:0 0 24px;width:24px;height:24px;border-radius:50%;background:#0d1b3d;
  border:1px solid #91a9ff55;display:grid;place-items:center;
}
.pm-spinner svg{width:15px;height:15px;animation:pm-spin 1.5s linear infinite}
.pm-copy{flex:1;min-width:0}
.pm-title{font-size:13px;font-weight:700;line-height:1.25;white-space:nowrap}
.pm-meta{font-size:10px;color:#c9d8ff;margin-top:2px;white-space:nowrap;font-variant-numeric:tabular-nums}
.pm-close{
  flex:0 0 auto;width:22px;height:22px;min-width:22px;min-height:0;
  aspect-ratio:1;border-radius:50%;border:1px solid #ffffff44;
  background:#ffffff14;color:#fff;font-size:13px;line-height:1;
  padding:0;box-shadow:none;box-sizing:border-box;cursor:pointer;
}
.pm-close:hover{background:#ffffff2e}
@keyframes pm-in{from{opacity:0;transform:translate(-50%,-12px)}to{opacity:1;transform:translate(-50%,0)}}
@keyframes pm-spin{to{transform:rotate(360deg)}}
@media(max-width:760px){
  body>.portal-match-box{min-width:0;padding:5px 8px 6px;gap:7px}
  .pm-title{font-size:11px}
  .pm-meta{font-size:9px}
}
@media(prefers-reduced-motion:reduce){
  body>.portal-match-box,body>.portal-match-box *{animation:none!important}
}
