:root {
  --home-ink: #191a2b;
  --home-muted: #6b6c7d;
  --home-brand: #17182b;
  --home-primary: #5b50e6;
  --home-primary-dark: #473dc5;
  --home-line: #e3e2ed;
  --home-paper: #f6f6fb;
}

html { scroll-behavior: smooth; }

body.home-body {
  min-height: 100vh;
  color: var(--home-ink);
  background: var(--home-paper);
  -webkit-font-smoothing: antialiased;
}

.home-body > .navbar {
  position: relative;
  z-index: 20;
  min-height: 74px;
  padding: 0;
  border: 0;
  background: var(--home-brand) !important;
  box-shadow: none;
}

.home-body > .navbar .container-fluid {
  width: min(1180px, calc(100% - 48px));
  min-height: 74px;
  margin: 0 auto;
  padding: 0;
}

.home-body > .navbar .navbar-brand,
.home-body > .navbar .nav-link { color: rgba(255, 255, 255, .72); }

.home-body > .navbar .navbar-brand {
  color: #fff;
  font-size: 1.12rem;
  font-weight: 760;
  letter-spacing: -.025em;
}

.home-body > .navbar .navbar-brand .bi {
  width: 34px;
  height: 34px;
  display: inline-grid;
  margin-right: 8px;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(255,255,255,.13), rgba(255,255,255,.04));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  font-size: 1rem;
}

.home-body > .navbar .navbar-nav { align-items: center; gap: 3px; }

.home-body > .navbar .nav-link {
  margin: 0 2px;
  padding: 8px 11px;
  border: 0 !important;
  border-radius: 8px;
  font-size: .87rem;
  font-weight: 650;
  transition: color 160ms ease, background 160ms ease;
}

.home-body > .navbar .nav-link:hover,
.home-body > .navbar .nav-link:focus,
.home-body > .navbar .nav-link.active { color: #fff; background: rgba(255,255,255,.08); }
.home-body > .navbar .dropdown-divider { border-color: rgba(255,255,255,.14); }
.home-body > .navbar .navbar-toggler { border-color: rgba(255,255,255,.2); }
.home-body > .navbar .navbar-toggler-icon { filter: invert(1) grayscale(1) brightness(2); }
/* The leaderboard's Tailwind CDN stylesheet also defines `.collapse` as a
   visibility utility. Keep Bootstrap's navbar collapse class visible while
   Bootstrap uses display/height to control its actual open state. */
.home-body > .navbar .navbar-collapse.collapse { visibility: visible; }

.home-page {
  min-height: 0;
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  overflow: hidden;
  background: var(--home-paper);
}
.home-shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }

.home-hero {
  position: relative;
  min-height: 136px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, rgba(255,255,255,.035), transparent 43%), var(--home-brand);
  isolation: isolate;
}

.home-hero::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 10px;
  content: "";
  background: var(--home-paper);
  clip-path: polygon(0 100%, 100% 14%, 100% 100%);
}

.hero-glow { position: absolute; z-index: -1; border-radius: 50%; filter: blur(3px); pointer-events: none; }
.hero-glow-one { top: -290px; right: -180px; width: 640px; height: 640px; background: rgba(110,91,242,.37); }
.hero-glow-two { bottom: -360px; left: -250px; width: 620px; height: 620px; background: rgba(172,83,229,.18); }

.hero-layout {
  min-height: 124px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: center;
  gap: clamp(34px, 5vw, 60px);
  padding: 3px 0 12px;
}

.eyebrow { margin: 0 0 17px; color: var(--home-primary); font-size: .72rem; font-weight: 850; letter-spacing: .145em; text-transform: uppercase; }

.hero-copy h1 {
  max-width: 630px;
  margin: 0;
  font-size: clamp(2.2rem, 3.35vw, 3.15rem);
  font-weight: 800;
  line-height: .93;
  letter-spacing: -.066em;
}

.hero-copy h1 span { display: block; color: #a99fff; }
.game-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 19px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: .86rem;
  font-weight: 780;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover { transform: translateY(-2px); }
.button:focus-visible, .home-footer a:focus-visible { outline: 3px solid rgba(125,111,255,.38); outline-offset: 4px; }
.button-primary { color: #fff; background: linear-gradient(110deg, var(--home-primary), #7164ee); box-shadow: 0 10px 24px rgba(67,55,191,.28), inset 0 1px 0 rgba(255,255,255,.2); }
.button-primary:hover { color: #fff; box-shadow: 0 15px 30px rgba(67,55,191,.36), inset 0 1px 0 rgba(255,255,255,.2); }
.button-dark { min-height: 43px; padding: 0 16px; color: #fff; background: var(--home-brand); box-shadow: 0 7px 15px rgba(23,24,43,.14); }
.button-dark:hover { color: #fff; background: #292a43; box-shadow: 0 10px 20px rgba(23,24,43,.2); }
.button-secondary {
  min-height: 43px;
  padding: 0 16px;
  color: var(--home-primary-dark);
  border-color: rgba(91,80,230,.22);
  background: #f3f1ff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.button-secondary:hover { color: #3830a5; border-color: rgba(91,80,230,.4); background: #e9e6ff; }

.hero-showcase {
  position: relative;
  width: min(100%, 310px);
  margin-left: auto;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(255,255,255,.095), rgba(255,255,255,.035));
  box-shadow: 0 32px 70px rgba(4,4,18,.32), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
  transform: rotate(1.5deg);
}

.hero-showcase::before { position: absolute; inset: 6px -7px -7px 6px; z-index: -1; content: ""; border: 1px solid rgba(142,124,255,.25); border-radius: 17px; background: rgba(107,88,234,.08); }
.showcase-topline, .showcase-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.showcase-kicker { color: #f4f4f9; font-size: .64rem; font-weight: 760; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; color: #bfc0d3; border: 1px solid rgba(255,255,255,.09); border-radius: 999px; background: rgba(0,0,0,.11); font-size: .55rem; font-weight: 680; }
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: #7de1a9; box-shadow: 0 0 0 3px rgba(125,225,169,.1); }
.word-board { display: grid; gap: 4px; margin: 3px auto; }
.word-row { display: flex; justify-content: center; gap: 4px; }
.word-row:nth-child(2) { transform: translateX(6px); }

.word-tile {
  width: clamp(29px, 2.55vw, 32px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 7px;
  background: linear-gradient(145deg, #8174ff, #5d50d5);
  box-shadow: 0 10px 18px rgba(5,5,20,.22), inset 0 1px 0 rgba(255,255,255,.25);
  font-size: clamp(.76rem, 1.2vw, .92rem);
  font-weight: 850;
}

.word-tile.is-purple { background: linear-gradient(145deg, #ba6ff0, #8744c3); }
.showcase-footer { padding-top: 5px; color: #85869e; border-top: 1px solid rgba(255,255,255,.08); font-size: .55rem; }
.showcase-footer > span:first-child { display: grid; }
.showcase-footer strong { color: #fff; font-size: .82rem; line-height: 1; }
.avatar-stack { display: flex; margin-left: auto; }
.avatar-stack span { width: 21px; height: 21px; display: grid; place-items: center; margin-left: -5px; color: #fff; border: 2px solid #292a43; border-radius: 50%; background: #5b50e6; font-size: .48rem; font-weight: 800; }
.avatar-stack span:nth-child(2) { background: #a557d7; }
.avatar-stack span:nth-child(3) { background: #417bc8; }

.game-library { padding: 18px 0 56px; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }

.game-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(48,44,91,.09);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(41,36,93,.075), 0 2px 7px rgba(31,28,69,.035);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.game-card:hover { transform: translateY(-6px); box-shadow: 0 25px 55px rgba(41,36,93,.13), 0 3px 9px rgba(31,28,69,.05); }
.game-art { position: relative; aspect-ratio: 16 / 10; padding: 16px; overflow: hidden; background: #e9e8f6; }

.game-art picture, .game-art img { width: 100%; height: 100%; display: block; }
.game-art img { object-fit: contain; object-position: center; transition: transform 450ms ease; }
.game-card:hover .game-art img { transform: scale(1.035); }

.game-badge {
  position: absolute;
  right: 20px;
  bottom: 18px;
  z-index: 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 13px;
  background: linear-gradient(145deg, #8275ff, #5e52d4);
  box-shadow: 0 9px 20px rgba(24,23,50,.25), inset 0 1px 0 rgba(255,255,255,.25);
  font-weight: 850;
}

.game-card-twirl .game-badge { background: linear-gradient(145deg, #bd70ed, #8b47c1); }
.game-card-towerd .game-badge { background: linear-gradient(145deg, #5c9de6, #406fc2); }
.game-number { position: absolute; top: 18px; left: 18px; z-index: 2; padding: 5px 8px; color: #fff; border: 1px solid rgba(255,255,255,.17); border-radius: 7px; background: rgba(23,24,43,.7); backdrop-filter: blur(7px); font-size: .62rem; font-weight: 850; letter-spacing: .1em; }
.game-content { display: flex; flex: 1; flex-direction: column; padding: 20px; }
.game-card-heading { display: flex; flex-direction: column-reverse; align-items: flex-start; }
.game-meta { display: flex; gap: 8px; margin-bottom: 11px; }
.game-meta span { padding: 5px 8px; color: #686879; border-radius: 6px; background: #f1f0f8; font-size: .62rem; font-weight: 760; letter-spacing: .035em; text-transform: uppercase; }
.game-content h3 { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.04em; }
.game-content > p { min-height: 68px; margin: 11px 0 17px; color: var(--home-muted); font-size: .86rem; line-height: 1.55; }
.game-actions { justify-content: flex-start; margin-top: auto; }
.game-actions-multiplayer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.game-actions-multiplayer .button { width: 100%; padding: 8px; gap: 6px; font-size: .78rem; text-align: center; }

.account-cta { padding: 0 0 70px; background: var(--home-paper); }
.account-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 60px;
  overflow: hidden;
  padding: 42px 46px;
  color: #fff;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,.045), transparent 45%), var(--home-brand);
  box-shadow: 0 24px 55px rgba(41,36,93,.16);
}
.account-panel::after { position: absolute; top: -190px; right: -110px; width: 380px; height: 380px; content: ""; border-radius: 50%; background: rgba(109,91,242,.24); pointer-events: none; }
.account-copy { position: relative; z-index: 1; }
.account-copy .eyebrow { margin-bottom: 10px; color: #afa7ff; }
.account-copy h2 { max-width: 670px; margin: 0; color: #fff; font-size: clamp(2rem, 3.7vw, 3rem); font-weight: 790; line-height: 1.02; letter-spacing: -.05em; text-align: left; }
.account-copy > p:not(.eyebrow) { margin: 13px 0 22px; color: #b7b8ca; font-size: .9rem; line-height: 1.6; }
.account-copy .button { min-height: 44px; }
.account-benefits { position: relative; z-index: 1; display: grid; gap: 9px; min-width: 220px; margin: 0; padding: 0; list-style: none; }
.account-benefits li { display: flex; align-items: center; gap: 11px; padding: 10px 13px; color: #d4d4e1; border: 1px solid rgba(255,255,255,.09); border-radius: 10px; background: rgba(255,255,255,.052); font-size: .77rem; font-weight: 680; }
.account-benefits .bi { width: 27px; height: 27px; display: grid; flex: 0 0 27px; place-items: center; color: #b6adff; border-radius: 8px; background: rgba(113,100,238,.16); font-size: .76rem; }

.mini-brand-mark { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 5px; border: 1px solid rgba(255,255,255,.16); border-radius: 12px; background: rgba(255,255,255,.08); }
.mini-brand-mark span { border-radius: 3px; background: #fff; }
.mini-brand-mark span:nth-child(2) { background: #9c8cff; }
.mini-brand-mark span:nth-child(3) { background: #c370ff; }
.mini-brand-mark span:nth-child(4) { background: #7668ed; }

.home-footer { margin-top: auto; padding: 25px 0; color: #8f90a4; background: #10111e; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; font-size: .75rem; }
.footer-inner p { margin: 0; }
.footer-brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; font-size: .87rem; font-weight: 760; text-decoration: none; }
.mini-brand-mark { width: 28px; height: 28px; gap: 2px; padding: 4px; border-radius: 8px; }
.home-footer > .home-shell > a:last-child { color: #aaaabd; font-weight: 650; text-decoration: none; }
.home-footer > .home-shell > a:last-child:hover { color: #fff; }

@media (max-width: 1060px) {
  .hero-layout { grid-template-columns: minmax(0, 1fr) 285px; gap: 34px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 991.98px) {
  .home-body > .navbar .container-fluid { width: min(100% - 36px, 680px); }
  .home-body > .navbar .navbar-collapse { margin: 0 -18px; padding: 13px 18px 18px; border-top: 1px solid rgba(255,255,255,.08); background: var(--home-brand); }
  .home-body > .navbar .navbar-nav { align-items: stretch; }
  .home-body > .navbar hr.dropdown-divider { margin: 10px 0; }
}

@media (max-width: 820px) {
  .home-shell { width: min(100% - 36px, 680px); }
  .home-hero, .account-cta { display: none; }
  .game-library { padding: 18px 0 42px; }
  .game-grid { gap: 20px; }
  .game-card { border-radius: 18px; }
  .game-card:hover { transform: none; }
  .game-art { aspect-ratio: 16 / 10; }
  .game-content { padding: 22px; }
  .game-content > p { min-height: 0; }
  .game-actions .button { min-height: 44px; }
  .home-footer { padding: 20px 0; }
}

@media (max-width: 560px) {
  .home-body > .navbar .container-fluid, .home-shell { width: calc(100% - 28px); }
  .home-body > .navbar, .home-body > .navbar .container-fluid { min-height: 66px; }
  .home-body > .navbar .navbar-collapse { margin-inline: -14px; padding-inline: 14px; }
  .game-library { padding-top: 14px; }
  .game-grid { grid-template-columns: 1fr; }
  .game-library-toolbar { flex-wrap: wrap; }
  .game-content { padding: 20px; }
  .game-content h3 { font-size: 1.55rem; }
  .game-actions { gap: 8px; }
  .game-actions .button { font-size: .8rem; padding-inline: 10px; }
  .footer-inner { flex-direction: row; gap: 10px; }
  .footer-inner > p { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .game-card, .game-art img, .button { transition: none; }
  .game-card:hover, .button:hover { transform: none; }
}

.game-card-tetherwake .game-badge { background: linear-gradient(145deg, #266e72, #153746); }
.game-card-tetherwake .game-art img { object-position: center; }

.game-card-wurdle .game-art { background: #eff1ed; }
.game-card-twirl .game-art { background: #eeeafa; }
.game-card-towerd .game-art { background: #e5edf3; }
.game-card-tetherwake .game-art { background: #0b2532; }
.game-card-riftfin .game-art { background: #103440; }
.game-card-riftfin .game-badge { background: linear-gradient(145deg, #4b9c98, #286466); }

/* Native buttons keep every filter one click away and keyboard accessible. */
.game-library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.game-filters { display: inline-flex; gap: 4px; padding: 5px; border: 1px solid var(--home-line); border-radius: 12px; background: #eeedf6; }
.game-filters[hidden], .game-card[hidden] { display: none; }
.game-filter { min-height: 40px; padding: 8px 16px; border: 0; border-radius: 8px; color: var(--home-muted); background: transparent; font: inherit; font-size: .82rem; font-weight: 700; }
.game-filter:hover { color: var(--home-ink); background: #ffffff80; }
.game-filter.is-active { color: #fff; background: var(--home-brand); box-shadow: 0 2px 5px #17182b20; }
.game-filter:focus-visible { outline: 3px solid #a99fff; outline-offset: 3px; }
.game-filter-status { margin: 0; color: var(--home-muted); font-size: .8rem; }
@media (max-width: 560px) {
  .game-filter { padding-inline: 12px; font-size: .78rem; }
}

.game-card-wurdle .game-art, .game-card-twirl .game-art { padding: 0; background: #f6f6fb; }
.game-card-wurdle .game-art img, .game-card-twirl .game-art img { object-fit: cover; }
.game-card-blackstar .game-art { padding: 0; background: #10141b; }
.game-card-blackstar .game-art img { object-fit: cover; }
.game-card-twofold .game-art { padding: 0; background: #10141b; }
.game-card-twofold .game-art img { object-fit: contain; }
