:root {
  --home-bg: #080c12;
  --home-panel: #10161e;
  --home-panel-2: #151d27;
  --home-line: rgba(204, 226, 231, 0.14);
  --home-text: #f4f8f7;
  --home-muted: #9cacb4;
  --home-green: #46e68d;
  --home-cyan: #36d9e8;
  --home-purple: #8f7bff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.portal-mode {
  display: block;
  background: var(--home-bg);
  color: var(--home-text);
}

body.portal-mode::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(54, 217, 232, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 230, 141, 0.03) 1px, transparent 1px);
  background-size: 72px 72px;
  content: "";
}

body.portal-mode .site-home {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 34px 70px;
}

.home-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-areas: "brand links" "actions actions";
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 28px;
  min-height: 124px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--home-line);
  background: rgba(8, 12, 18, 0.94);
  backdrop-filter: blur(18px);
}

.home-brand {
  grid-area: brand;
  color: var(--home-text);
  font-size: 1.28rem;
  font-weight: 950;
  letter-spacing: 0;
  text-decoration: none;
}

.home-brand span { color: var(--home-green); }

.home-nav-links,
.home-nav-actions,
.home-hero-actions,
.section-heading,
.catalog-tools,
.category-filters {
  display: flex;
  align-items: center;
}

.home-nav-links { grid-area: links; justify-content: flex-end; gap: 6px; min-width: 0; }
.home-nav [hidden] { display: none !important; }

.home-nav-links a,
.home-nav-links button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: #bac8ce;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.home-nav-links a:hover,
.home-nav-links button:hover { background: #151d27; color: #fff; }
.home-nav-links svg { width: 16px; height: 16px; }
.home-nav-actions { grid-area: actions; justify-content: flex-end; gap: 9px; min-width: 0; }
.home-nav-actions .home-search-nav { flex: 1 1 320px; max-width: 520px; margin-right: auto; }
.home-nav-actions .home-search-nav input { width: 100%; }

.home-search {
  position: relative;
  display: flex;
  align-items: center;
}

.home-search svg {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: #7f929b;
  pointer-events: none;
}

.home-search input {
  width: 210px;
  height: 40px;
  border: 1px solid var(--home-line);
  border-radius: 6px;
  padding: 0 12px 0 38px;
  background: #0d131a;
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
}

.home-search input::placeholder { color: #71838c; }

.home-nav .top-play-button,
.home-nav .creator-gift,
.home-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  margin: 0;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  cursor: pointer;
}

.home-nav .top-play-button { padding: 0 16px; background: var(--home-green); color: #06130d; }
.home-nav .top-play-button svg { width: 16px; fill: currentColor; }
.home-nav .creator-gift { width: 40px; padding: 0; background: #1a2430; color: #ffd75e; }
.home-menu-toggle { display: none; width: 40px; background: #151d27; color: #fff; }

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(460px, 1.12fr);
  min-height: 520px;
  margin-top: 26px;
  overflow: hidden;
  border: 1px solid var(--home-line);
  border-radius: 8px;
  background: #0d1820;
}

.home-hero-copy {
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 54px clamp(30px, 5vw, 72px);
}

.home-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 13px;
  color: var(--home-cyan);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.home-eyebrow > span { width: 24px; height: 2px; background: var(--home-cyan); }
.home-hero h1 { max-width: 560px; font-size: clamp(3.2rem, 7vw, 6.7rem); line-height: 0.9; }
.home-hero-copy > p:not(.home-eyebrow) { max-width: 600px; margin: 22px 0 28px; color: #b9c8cc; font-size: 1.03rem; line-height: 1.65; }
.home-hero-actions { flex-wrap: wrap; gap: 14px; }

.home-primary-action,
.home-feature-card button,
.community-strip > button,
.catalog-empty button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--home-green);
  color: #07140e;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.home-hero-actions > a,
.section-heading > a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #c8d5d9;
  font-size: 0.88rem;
  font-weight: 850;
  text-decoration: none;
}

.home-hero-actions svg,
.section-heading svg,
.home-feature-card button svg { width: 17px; height: 17px; }

.hero-facts {
  display: flex;
  gap: 32px;
  margin: 38px 0 0;
}

.hero-facts div { border-left: 2px solid var(--home-green); padding-left: 12px; }
.hero-facts dt { color: #778a93; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.hero-facts dd { margin: 4px 0 0; color: #e7f0f1; font-size: 0.9rem; font-weight: 850; }

.home-hero-art {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  background: #063a57;
}

.home-hero-art::before {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 14%, rgba(119, 242, 255, 0.24), transparent 26%),
    linear-gradient(180deg, rgba(70, 230, 141, 0.12), transparent 42%);
  content: "";
}

.hero-sunbeam {
  position: absolute;
  top: -25%;
  left: 26%;
  width: 34%;
  height: 100%;
  background: rgba(122, 237, 246, 0.08);
  transform: skewX(-18deg);
}

.hero-fish {
  position: absolute;
  top: 44%;
  left: 48%;
  width: min(430px, 57%);
  aspect-ratio: 1.65;
  border: 5px solid #0b242e;
  border-radius: 52% 58% 52% 48%;
  background: #23a9ba;
  box-shadow: inset -46px -22px 0 rgba(0, 47, 72, 0.2), 0 28px 50px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%) rotate(-4deg);
}

.hero-fish::before {
  position: absolute;
  inset: 18% 9% 18% 28%;
  border-radius: 50%;
  border-top: 6px solid rgba(183, 255, 247, 0.42);
  content: "";
}

.hero-fish-tail {
  position: absolute;
  top: 15%;
  right: 88%;
  width: 45%;
  height: 70%;
  background: #17758f;
  clip-path: polygon(0 0, 100% 50%, 0 100%, 16% 50%);
}

.hero-fish-fin {
  position: absolute;
  top: -24%;
  left: 43%;
  width: 26%;
  height: 39%;
  background: #17758f;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.hero-fish-eye { position: absolute; top: 26%; right: 16%; width: 15%; aspect-ratio: 1; border: 6px solid #fff; border-radius: 50%; background: #10222a; box-shadow: inset 8px 0 0 var(--home-cyan); }
.hero-fish-gill { position: absolute; top: 34%; right: 33%; width: 8%; height: 32%; border-left: 4px solid rgba(5, 57, 73, 0.65); border-radius: 50%; }
.hero-bubble { position: absolute; border: 2px solid rgba(166, 246, 255, 0.65); border-radius: 50%; }
.hero-bubble.bubble-one { top: 18%; right: 15%; width: 20px; height: 20px; }
.hero-bubble.bubble-two { top: 26%; right: 8%; width: 10px; height: 10px; }
.hero-bubble.bubble-three { top: 11%; right: 26%; width: 8px; height: 8px; }
.hero-seabed { position: absolute; right: 0; bottom: 0; left: 0; height: 23%; background: #082f31; clip-path: polygon(0 42%, 14% 20%, 30% 48%, 47% 24%, 67% 50%, 84% 18%, 100% 36%, 100% 100%, 0 100%); }
.hero-seabed i { position: absolute; bottom: 18px; width: 6px; height: 74px; border-radius: 100% 0; background: #2dc87e; transform-origin: bottom; }
.hero-seabed i:nth-child(1) { left: 16%; transform: rotate(-13deg); }
.hero-seabed i:nth-child(2) { left: 76%; height: 98px; transform: rotate(12deg); }
.hero-seabed i:nth-child(3) { left: 84%; height: 55px; transform: rotate(-8deg); }

.home-section { margin-top: 64px; scroll-margin-top: 90px; }
.section-heading { justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1; }
.section-heading .home-eyebrow { margin-bottom: 9px; }
.section-heading > div > p:last-child { margin: 10px 0 0; color: var(--home-muted); }

.featured-picks-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.home-feature-card { overflow: hidden; border: 1px solid var(--home-line); border-radius: 8px; background: var(--home-panel); transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
.home-feature-card:hover { transform: translateY(-4px); border-color: rgba(54, 217, 232, 0.45); box-shadow: 0 20px 42px rgba(0, 0, 0, 0.24); }
.home-feature-art { height: 210px; border-bottom: 1px solid var(--home-line); }
.home-feature-art canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.home-feature-card > div:last-child { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 20px; }
.home-feature-card span { grid-column: 1/-1; color: var(--home-cyan); font-size: 0.72rem; font-weight: 900; text-transform: uppercase; }
.home-feature-card h3 { margin: 0; color: #fff; font-size: 1.28rem; }
.home-feature-card p { grid-column: 1/-1; min-height: 48px; margin: 0; color: var(--home-muted); font-size: 0.86rem; line-height: 1.45; }
.home-feature-card button { grid-column: 2; grid-row: 2; min-height: 36px; padding: 0 13px; font-size: 0.8rem; }


.catalog-heading { align-items: end; }
.catalog-heading > span { color: var(--home-muted); font-size: 0.84rem; font-weight: 800; }
.catalog-tools { justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.category-filters { flex-wrap: wrap; gap: 8px; }
.category-filters button { min-height: 36px; border: 1px solid var(--home-line); border-radius: 6px; padding: 0 13px; background: #101720; color: #9fb0b7; font: inherit; font-size: 0.78rem; font-weight: 850; cursor: pointer; }
.category-filters button:hover { border-color: rgba(54, 217, 232, 0.45); color: #fff; }
.category-filters button.is-active { border-color: var(--home-green); background: rgba(70, 230, 141, 0.12); color: #bcffd8; }
.catalog-search input { width: min(320px, 34vw); }

.catalog-section .game-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.catalog-section .mini-game-card { display: grid; grid-template-rows: 150px auto auto minmax(58px, 1fr) 44px; min-height: 330px; border: 1px solid var(--home-line); border-radius: 8px; background: var(--home-panel); transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease; }
.catalog-section .mini-game-card[hidden] { display: none !important; }
.catalog-section .mini-game-card:hover { transform: translateY(-3px); border-color: rgba(70, 230, 141, 0.45); box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22); }
.catalog-section .mini-art { height: 150px; border-bottom: 1px solid var(--home-line); }
.catalog-section .mini-game-card {
  content-visibility: auto;
  contain-intrinsic-size: 330px;
}
.catalog-section img,
.catalog-section canvas { display: block; width: 100%; height: 100%; }
[data-game-launch][aria-busy="true"] { cursor: progress; opacity: .72; }
.catalog-section .mini-game-card > strong { overflow: visible; margin: 15px 0 0; padding: 0 16px; font-size: 1rem; line-height: 1.25; text-overflow: clip; white-space: normal; }
.catalog-section .mini-game-card > span { margin: 5px 0 0; padding: 0 16px; color: var(--home-cyan); font-size: 0.7rem; }
.catalog-section .game-card-description { margin: 10px 0 0; padding: 0 16px; color: var(--home-muted); font-size: 0.78rem; line-height: 1.42; }
.catalog-section .live-game-card button { position: static; justify-self: start; align-self: center; min-height: 32px; margin: 0 16px; padding: 0 13px; border-radius: 5px; }
.catalog-empty { display: grid; justify-items: center; gap: 10px; border: 1px dashed var(--home-line); border-radius: 8px; padding: 46px; color: var(--home-muted); text-align: center; }
.catalog-empty[hidden] { display: none; }
.catalog-empty svg { width: 34px; height: 34px; color: var(--home-cyan); }
.catalog-empty strong { color: #fff; font-size: 1.1rem; }
.catalog-empty button { margin-top: 5px; }

.home-nav :focus-visible,
.home-hero :focus-visible,
.home-section :focus-visible,
.community-strip :focus-visible {
  outline: 3px solid #82f3ff;
  outline-offset: 3px;
}

@media (max-width: 1120px) {
  .home-nav { grid-template-areas: "brand toggle" "actions actions"; grid-template-columns: minmax(0,1fr) auto; gap: 9px 14px; min-height: 124px; }
  .home-menu-toggle { display: inline-flex; }
  .home-menu-toggle { grid-area: toggle; justify-self: end; }
  .home-nav-links { position: absolute; top: 62px; left: 0; display: none; width: min(300px,calc(100vw - 28px)); border: 1px solid var(--home-line); border-radius: 8px; padding: 8px; background: #0d131a; box-shadow: 0 20px 45px rgba(0,0,0,.4); }
  .home-nav-links.is-open { display: grid; }
  .home-nav-links a, .home-nav-links button { justify-content: flex-start; width: 100%; }
  .home-nav-actions { justify-self: end; }
  .featured-picks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .featured-picks-grid .home-feature-card:first-child { grid-column: 1/-1; }
  .catalog-section .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  body.portal-mode .site-home { padding-inline: 18px; }
  .home-nav { grid-template-columns: minmax(0,1fr) auto; }
  .home-nav-actions { flex-wrap: wrap; width: 100%; }
  .home-nav-actions .home-search-nav { min-width: 0; flex: 1 0 100%; max-width: none; margin-right: 0; }
  .home-hero { grid-template-columns: 1fr; min-height: 0; }
  .home-hero-copy { padding: 42px 28px; }
  .home-hero h1 { font-size: clamp(3rem, 13vw, 5.2rem); }
  .home-hero-art { min-height: 360px; }
  .catalog-tools { align-items: stretch; flex-direction: column; }
  .catalog-search input { width: 100%; }
  .catalog-section .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  body.portal-mode .site-home { padding: 0 10px 50px; }
  .home-nav { min-height: 174px; gap: 8px; padding-block: 9px; }
  .home-brand { font-size: 1rem; }
  .home-nav .top-play-button { min-width: 44px; min-height: 44px; padding: 0 8px; font-size: 12px; }
  .home-nav .creator-gift,
  .home-menu-toggle { width: 44px; min-height: 44px; }
  .home-nav .top-play-button svg { width: 17px; height: 17px; }
  .home-nav-actions { flex-wrap: wrap; justify-content: space-between; width: 100%; }
  .home-nav-actions .home-search-nav { order: -1; flex: 1 0 100%; max-width: none; margin: 0 0 2px; }
  .home-hero { margin-top: 14px; }
  .home-hero-copy { padding: 34px 22px; }
  .home-hero-copy > p:not(.home-eyebrow) { font-size: 0.93rem; }
  .home-hero-art { min-height: 280px; }
  .hero-fish { width: 64%; }
  .hero-facts { gap: 18px; }
  .home-section { margin-top: 48px; }
  .section-heading { align-items: flex-start; }
  .section-heading > a { display: none; }
  .featured-picks-grid { grid-template-columns: 1fr; }
  .featured-picks-grid .home-feature-card:first-child { grid-column: auto; }
  .home-feature-art { height: 180px; }
  .category-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; scrollbar-width: thin; }
  .category-filters button { flex: 0 0 auto; }
  .catalog-section .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .catalog-section .mini-game-card { grid-template-rows: 118px auto auto minmax(74px, 1fr) 42px; min-height: 300px; }
  .catalog-section .mini-art { height: 118px; }
  .catalog-section .mini-game-card > strong { margin-top: 11px; padding-inline: 11px; font-size: 0.86rem; }
  .catalog-section .mini-game-card > span { padding-inline: 11px; font-size: 0.62rem; }
  .catalog-section .game-card-description { display: -webkit-box; overflow: hidden; margin-top: 7px; padding-inline: 11px; font-size: 0.68rem; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
  .catalog-section .live-game-card button { margin-inline: 11px; font-size: 0.72rem; }
}

@media (max-width: 340px) {
  .catalog-section .game-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
