* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.home-shell {
  margin: 0;
  color: #10253b;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, Helvetica, sans-serif;
  font-weight: 700;
  background:
    linear-gradient(58deg, rgba(24, 214, 194, 0.42) 0 9%, transparent 9% 18%, rgba(88, 231, 219, 0.46) 18% 25%, transparent 25%),
    linear-gradient(122deg, transparent 0 18%, rgba(88, 231, 219, 0.52) 18% 27%, transparent 27% 54%, rgba(18, 196, 185, 0.35) 54% 63%, transparent 63%),
    #35dcca;
  background-attachment: fixed;
  overflow-x: hidden;
}

.home-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 5;
  width: 238px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 10px 14px;
  background: #034d5f;
  border-right: 1px solid rgba(1, 42, 55, 0.62);
  box-shadow: 14px 0 32px rgba(1, 42, 55, 0.24);
  transition: width 0.2s ease;
}

.rail-top {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 46px;
}

.rail-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-content: center;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.rail-toggle span {
  width: 20px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: #e8fffb;
}

.home-logo {
  min-width: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 6px;
  text-decoration: none;
}

.home-logo img {
  max-width: 100%;
  max-height: 52px;
  object-fit: contain;
}

.home-logo span {
  color: #e8fffb;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.24);
}

.rail-search-wrap {
  min-width: 0;
}

.rail-search {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  min-width: 0;
  height: 42px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(232, 255, 251, 0.92);
  box-shadow: 0 8px 20px rgba(0, 61, 79, 0.18);
}

.rail-search input {
  min-width: 0;
  height: 42px;
  padding: 0 10px;
  border: 0;
  outline: none;
  background: transparent;
  color: #04384a;
  font-size: 14px;
  font-weight: 800;
}

.rail-search input::placeholder {
  color: rgba(4, 56, 74, 0.64);
}

.rail-search button {
  width: 38px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #075f73;
  cursor: pointer;
}

.rail-search svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-menu {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
}

.side-link {
  min-height: 38px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 5px 7px;
  border-radius: 8px;
  color: #e8fffb;
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.side-link:hover,
.side-link:focus-visible {
  background: rgba(232, 255, 251, 0.14);
  outline: none;
}

.side-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(118, 94, 255, 0.22);
  object-fit: cover;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.side-letter {
  background: linear-gradient(135deg, #39e7d6, #765eff);
}

.side-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-link {
  grid-template-columns: minmax(0, 1fr);
  padding-left: 10px;
}

.text-only-link {
  grid-template-columns: minmax(0, 1fr);
  padding-left: 10px;
}

.side-divider {
  height: 1px;
  margin: 8px 4px;
  background: rgba(232, 255, 251, 0.18);
}

.rail-socials {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 4px 0;
  margin-top: auto;
  border-top: 1px solid rgba(232, 255, 251, 0.18);
}

.rail-socials a {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(232, 255, 251, 0.12);
}

.rail-socials img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
}

body.rail-collapsed .home-rail {
  width: 64px;
}

body.rail-collapsed .home-logo,
body.rail-collapsed .rail-search input,
body.rail-collapsed .side-label {
  display: none;
}

body.rail-collapsed .rail-top {
  grid-template-columns: 1fr;
}

body.rail-collapsed .rail-search {
  grid-template-columns: 1fr;
}

body.rail-collapsed .rail-search button {
  width: 100%;
}

body.rail-collapsed .side-link {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 6px 4px;
}

body.rail-collapsed .rail-socials {
  justify-content: center;
  padding-inline: 0;
}

body.rail-collapsed .category-link {
  display: none;
}

body.rail-collapsed .text-only-link {
  display: none;
}

.mosaic {
  min-height: 100vh;
  padding: 14px 18px 18px 256px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  grid-auto-rows: 94px;
  grid-auto-flow: dense;
  gap: 16px;
  transition: padding-left 0.2s ease;
}

body.rail-collapsed .mosaic {
  padding-left: 82px;
}

.collection-row {
  grid-column: 1 / -1;
  grid-row: span 3;
  display: grid;
  gap: 8px;
  min-width: 0;
  align-self: start;
}

.collection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.collection-heading h2 {
  margin: 0;
  color: #072742;
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.45),
    0 4px 0 rgba(0, 0, 0, 0.08);
}

.collection-heading a {
  color: #0b5d91;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}

.collection-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 236px;
  grid-template-rows: 236px;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.trending-slider {
  overflow: hidden;
}

.trending-track {
  width: max-content;
  max-width: none;
  overflow: visible;
  scrollbar-width: none;
  animation: trendingSlide 32s linear infinite;
}

.trending-track::-webkit-scrollbar {
  display: none;
}

.trending-slider:hover .trending-track,
.trending-slider:focus-within .trending-track {
  animation-play-state: paused;
}

@keyframes trendingSlide {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-50% - 8px));
  }
}

.collection-tile {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 9px 26px rgba(18, 84, 102, 0.22);
  text-decoration: none;
  color: #fff;
}

.collection-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.collection-tile span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 22px 9px 8px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  text-shadow:
    0 2px 0 #000,
    0 0 8px rgba(0, 0, 0, 0.7);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
}

.search-main {
  min-height: 100vh;
  padding: 14px 18px 18px 256px;
  transition: padding-left 0.2s ease;
}

body.rail-collapsed .search-main {
  padding-left: 82px;
}

.search-panel {
  position: sticky;
  top: 14px;
  z-index: 4;
  display: grid;
  gap: 8px;
  max-width: 720px;
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(18, 84, 102, 0.2);
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.search-form input {
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 2px solid rgba(0, 152, 232, 0.18);
  border-radius: 8px;
  color: #10253b;
  font-size: 16px;
  font-weight: 700;
  outline: none;
}

.search-form input:focus {
  border-color: #0098e8;
}

.search-form button {
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: #0098e8;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.search-panel p {
  margin: 0;
  color: #31536d;
  font-size: 14px;
  font-weight: 800;
}

.search-mosaic {
  min-height: 0;
  padding: 0;
}

.empty-search {
  max-width: 520px;
  padding: 28px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(18, 84, 102, 0.2);
}

.empty-search h1 {
  margin: 0 0 8px;
  color: #10253b;
  font-size: 28px;
}

.empty-search p {
  margin: 0;
  color: #31536d;
  font-weight: 800;
}

.mosaic-tile {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 9px 26px rgba(18, 84, 102, 0.22);
  text-decoration: none;
  color: #fff;
  transform: translateZ(0);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.mosaic-tile:hover,
.mosaic-tile:focus-visible {
  transform: translateY(-4px) scale(1.025);
  box-shadow: 0 16px 34px rgba(18, 84, 102, 0.28);
  outline: none;
}

.mosaic-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.mosaic-tile span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 22px 9px 8px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  text-shadow:
    0 2px 0 #000,
    0 0 8px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateY(8px);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.mosaic-tile:hover span,
.mosaic-tile:focus-visible span {
  opacity: 1;
  transform: translateY(0);
}

.home-game-hidden {
  display: none;
}

.home-more-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 14px 0 8px;
}

.home-more-btn {
  min-width: 160px;
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 8px;
  background: #10253b;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(18, 84, 102, 0.22);
}

.home-more-btn:hover,
.home-more-btn:focus-visible {
  background: #0b5d91;
  outline: none;
}

.home-content-section {
  grid-column: 1 / -1;
  grid-row: span 4;
  align-self: start;
  width: min(1120px, 100%);
  justify-self: center;
  margin: 18px 0 18px;
  padding: 30px 34px;
  border: 1px solid rgba(7, 95, 115, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #07374b;
  box-shadow: 0 18px 38px rgba(7, 95, 115, 0.18);
}

.home-content-body {
  position: relative;
  overflow: hidden;
  transition: max-height 0.2s ease;
}

.home-content-body:not(.is-collapsed) {
  max-height: none;
}

.home-content-body.is-collapsed {
  max-height: 6.8em;
}

.home-content-body.is-collapsed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 46px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.96));
}

.home-content-section h1,
.home-content-section h2,
.home-content-section h3 {
  margin: 0 0 12px;
  color: #04384a;
}

.home-content-section p {
  margin: 0 0 12px;
  line-height: 1.65;
}

.home-content-section :last-child {
  margin-bottom: 0;
}

.home-content-toggle {
  display: block;
  margin: 18px auto 0;
  min-width: 140px;
  height: 42px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: #075f73;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.home-content-toggle:hover,
.home-content-toggle:focus-visible {
  background: #0a8794;
  outline: none;
}

.home-bottom-actions {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 24px 0 0;
}

.standalone-actions {
  grid-column: 1 / -1;
  grid-row: span 2;
  align-self: start;
  padding: 24px 0 58px;
}

.home-action-btn {
  min-width: 190px;
  height: 50px;
  padding: 0 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.random-game-btn {
  border: 2px solid #fff;
  background: rgba(23, 26, 40, 0.24);
  color: #fff;
}

.back-top-btn {
  border: 0;
  background: #059b8f;
  color: #fff;
}

.random-game-btn::before {
  content: "";
  margin: 0;
}

.back-top-btn::before {
  content: "↑";
  margin-right: 8px;
  font-size: 18px;
}

.home-action-btn:hover,
.home-action-btn:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.tile-sm {
  grid-column: span 1;
  grid-row: span 1;
}

.tile-md {
  grid-column: span 2;
  grid-row: span 2;
}

.tile-wide {
  grid-column: span 3;
  grid-row: span 2;
}

.tile-tall {
  grid-column: span 2;
  grid-row: span 3;
}

.tile-xl {
  grid-column: span 3;
  grid-row: span 3;
}

@media (max-width: 900px) {
  .home-rail {
    position: sticky;
    top: 0;
    inset: auto;
    width: 100%;
    max-height: 100vh;
    padding: 8px 10px;
    background: #034d5f;
    overflow-y: auto;
  }

  body.rail-collapsed .home-rail {
    width: 100%;
  }

  .home-logo img {
    max-height: 46px;
  }

  body.rail-collapsed .home-logo {
    display: flex;
  }

  .rail-top {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  body.rail-collapsed .rail-top {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .rail-search-wrap {
    width: 100%;
  }

  body.rail-collapsed .rail-search input {
    display: block;
  }

  body.rail-collapsed .rail-search {
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  body.rail-collapsed .rail-search button {
    width: 38px;
  }

  .side-menu {
    padding-top: 4px;
  }

  body.rail-collapsed .side-menu {
    display: none;
  }

  body.rail-collapsed .rail-socials {
    display: none;
  }

  body.rail-collapsed .text-only-link,
  body.rail-collapsed .category-link {
    display: grid;
  }

  .mosaic {
    padding: 10px;
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
    grid-auto-rows: 82px;
    gap: 10px;
  }

  body.rail-collapsed .mosaic {
    padding-left: 10px;
  }

  .collection-strip {
    grid-auto-columns: 136px;
    grid-template-rows: 136px;
    gap: 10px;
  }

  .collection-row {
    grid-row: span 2;
  }

  .collection-heading h2 {
    font-size: 24px;
  }

  .search-main {
    padding: 10px;
  }

  body.rail-collapsed .search-main {
    padding-left: 10px;
  }

  .search-panel {
    position: static;
  }

  .tile-xl,
  .tile-wide,
  .tile-tall {
    grid-column: span 2;
    grid-row: span 2;
  }
}

@media (max-width: 520px) {
  .mosaic {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 31vw;
  }

  .collection-strip {
    grid-auto-columns: 48vw;
    grid-template-rows: 48vw;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .tile-md,
  .tile-xl,
  .tile-wide,
  .tile-tall {
    grid-column: span 2;
    grid-row: span 2;
  }
}
