#screen-hub {
  --hub-cyan: #64f8ff;
  --hub-pink: #ff4da6;
  --hub-gold: #ffd23f;
  --hub-line-1: #fff;
  --hub-line-2: #ff4da6;
  --hub-line-3: #ff4da6;
  --hub-line-4: #ffd23f;
  --hub-ink: rgba(3, 8, 20, 0.86);
  isolation: isolate;
  overflow: hidden;
  background: #02050e;
  align-items: stretch;
}

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

.hub-demo-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(39, 90, 142, 0.42), transparent 50%),
    #02050e;
  z-index: -4;
}

#hub-demo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100vw, 106.667vh);
  aspect-ratio: 256 / 240;
  transform: translate(-50%, -50%);
  background: #02050e;
}

#hub-demo.ejs_parent,
#hub-demo .ejs_canvas_parent,
#hub-demo .ejs_canvas {
  width: 100% !important;
  height: 100% !important;
}

#hub-demo .ejs_canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#hub-demo .ejs_menu_bar,
#hub-demo .ejs_virtualGamepad_parent,
#hub-demo .ejs_start_button,
#hub-demo .ejs_game {
  display: none !important;
}

.hub-color-wash {
  position: absolute;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(1, 5, 16, 0.72) 0%, rgba(1, 5, 16, 0.16) 46%, rgba(1, 5, 16, 0.54) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 28%, rgba(0, 0, 0, 0.58) 100%),
    radial-gradient(circle at 68% 36%, rgba(38, 191, 255, 0.08), transparent 35%);
}

.hub-scanlines {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0.22;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 3px,
    rgba(0, 0, 0, 0.36) 4px
  );
  mix-blend-mode: multiply;
}

.hub-topbar {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  padding: 18px clamp(18px, 3vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.hub-topbar-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.hub-icon-button {
  pointer-events: auto;
  min-height: 38px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(2, 7, 18, 0.68);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hub-icon-button:hover,
.hub-icon-button:focus-visible {
  border-color: var(--hub-cyan);
  color: var(--hub-cyan);
  outline: none;
  box-shadow: 0 0 18px rgba(100, 248, 255, 0.28);
}

.hub-back-button {
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
}

.hub-back-button > span:first-child {
  font-size: 1.05rem;
}

.hub-language-switch {
  pointer-events: auto;
  display: flex;
  gap: 5px;
}

.hub-language-button {
  width: 58px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(2, 7, 18, 0.68);
  line-height: 1;
  filter: grayscale(0.72) brightness(0.72);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hub-language-flag {
  position: relative;
  width: 22px;
  height: 14px;
  flex: 0 0 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

.hub-language-flag-us {
  background: repeating-linear-gradient(
    to bottom,
    #b22234 0,
    #b22234 7.69%,
    #ffffff 7.69%,
    #ffffff 15.38%
  );
}

.hub-language-flag-us::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 46%;
  height: 54%;
  background:
    radial-gradient(circle, #ffffff 0 0.6px, transparent 0.8px) 0 0 / 3px 3px,
    #3c3b6e;
}

.hub-language-flag-ru {
  background: linear-gradient(
    to bottom,
    #ffffff 0 33.33%,
    #1c57a7 33.33% 66.66%,
    #d52b1e 66.66% 100%
  );
}

.hub-language-code {
  color: #ffffff;
  font-size: 0.42rem;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.hub-language-button:hover,
.hub-language-button:focus-visible {
  outline: none;
  border-color: var(--hub-cyan);
  filter: grayscale(0) brightness(1);
}

.hub-language-button[aria-pressed="true"] {
  border-color: var(--hub-gold);
  filter: grayscale(0) brightness(1);
  box-shadow: 0 0 13px rgba(255, 210, 63, 0.3), inset 0 -3px 0 var(--hub-gold);
}

.hub-mute-button {
  width: 46px;
  height: 42px;
  padding: 8px;
  display: grid;
  place-items: center;
}

.hub-mute-button .pixel-speaker {
  width: 30px;
  color: var(--hub-gold);
  filter: drop-shadow(0 0 5px rgba(255, 210, 63, 0.72));
}

.hub-mute-button.muted .pixel-speaker {
  color: #667083;
  filter: none;
}

.hub-status-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.46rem;
  letter-spacing: 0.15em;
  background: rgba(2, 7, 18, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hub-status-dot {
  width: 7px;
  height: 7px;
  background: #78ff97;
  box-shadow: 0 0 9px #78ff97;
  animation: hub-live-pulse 1.7s steps(2, end) infinite;
}

.hub-layout {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 0;
  padding: 82px clamp(20px, 5vw, 78px) 34px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(340px, 470px);
  align-items: center;
  gap: clamp(28px, 6vw, 92px);
}

.hub-title-block {
  align-self: center;
  max-width: 720px;
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.72), 0 0 28px rgba(0, 0, 0, 0.88);
  animation: hub-title-in 620ms steps(8, end) both;
}

.hub-eyebrow,
.hub-section-kicker {
  color: var(--hub-cyan);
  font-size: clamp(0.48rem, 0.85vw, 0.7rem);
  letter-spacing: 0.2em;
  line-height: 1.7;
}

.hub-title-block h1 {
  margin: 12px 0 10px;
  font-size: clamp(2.25rem, 5.9vw, 6.2rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
  color: var(--hub-line-1);
}

#hub-title-primary {
  color: var(--hub-line-1);
}

.hub-title-block h1 > span {
  display: block;
  width: max-content;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

#hub-title-accent {
  color: var(--hub-line-3);
  text-shadow:
    4px 4px 0 rgba(55, 0, 28, 0.9),
    0 0 22px rgba(255, 77, 166, 0.46);
}

#hub-title-connector {
  margin: 0.42em 0 0.2em;
  color: var(--hub-line-2);
  font-size: 0.32em;
  line-height: 1.25;
  letter-spacing: 0.08em;
  text-shadow:
    2px 2px 0 rgba(55, 0, 28, 0.9),
    0 0 14px rgba(255, 77, 166, 0.38);
}

.hub-wordmark-row {
  display: flex;
  align-items: center;
  gap: 15px;
  width: min(100%, 520px);
}

.hub-wordmark-line {
  height: 3px;
  flex: 1;
  background: linear-gradient(90deg, var(--hub-gold), var(--hub-pink));
  box-shadow: 0 0 12px rgba(255, 77, 166, 0.5);
}

.hub-wordmark-row strong {
  color: var(--hub-line-4);
  font-size: clamp(1.1rem, 2.25vw, 2rem);
  letter-spacing: 0.28em;
  white-space: nowrap;
}

.hub-subtitle {
  margin: 26px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(0.48rem, 0.8vw, 0.66rem);
  line-height: 2;
  letter-spacing: 0.14em;
  white-space: pre-line;
}

.hub-library {
  position: relative;
  width: 100%;
  height: min(76vh, 720px);
  min-height: 430px;
  padding: clamp(18px, 2.4vw, 28px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    linear-gradient(135deg, rgba(15, 27, 48, 0.92), var(--hub-ink)),
    rgba(3, 8, 20, 0.82);
  border: 1px solid rgba(100, 248, 255, 0.54);
  box-shadow:
    0 0 0 4px rgba(2, 7, 18, 0.58),
    0 0 0 5px rgba(255, 77, 166, 0.18),
    0 24px 70px rgba(0, 0, 0, 0.62),
    inset 0 0 45px rgba(31, 114, 168, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: hub-panel-in 520ms steps(7, end) 80ms both;
}

.hub-library::before,
.hub-library::after {
  content: "";
  position: absolute;
  width: 35px;
  height: 35px;
  pointer-events: none;
}

.hub-library::before {
  top: -5px;
  left: -5px;
  border-top: 4px solid var(--hub-gold);
  border-left: 4px solid var(--hub-gold);
}

.hub-library::after {
  right: -5px;
  bottom: -5px;
  border-right: 4px solid var(--hub-pink);
  border-bottom: 4px solid var(--hub-pink);
}

.hub-game-preview {
  position: absolute;
  z-index: 14;
  top: 132px;
  right: calc(100% + clamp(18px, 2.5vw, 38px));
  width: min(390px, 37vw);
  padding: 10px;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translateX(14px) scale(0.98);
  transform-origin: right center;
  background:
    linear-gradient(145deg, rgba(12, 24, 44, 0.97), rgba(2, 7, 18, 0.96));
  border: 1px solid rgba(100, 248, 255, 0.62);
  box-shadow:
    0 0 0 3px rgba(2, 7, 18, 0.72),
    0 0 24px rgba(100, 248, 255, 0.18),
    0 22px 55px rgba(0, 0, 0, 0.72);
  transition: opacity 120ms linear, transform 120ms ease-out, visibility 120ms;
}

.hub-game-preview.visible {
  visibility: visible;
  opacity: 1;
  transform: translateX(0) scale(1);
}

.hub-game-preview::before,
.hub-game-preview::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
}

.hub-game-preview::before {
  top: -4px;
  left: -4px;
  border-top: 3px solid var(--hub-gold);
  border-left: 3px solid var(--hub-gold);
}

.hub-game-preview::after {
  right: -4px;
  bottom: -4px;
  border-right: 3px solid var(--hub-pink);
  border-bottom: 3px solid var(--hub-pink);
}

.hub-game-preview-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 77, 166, 0.12), rgba(100, 248, 255, 0.12)),
    #00040d;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#hub-game-preview-image {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.hub-game-preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.34);
  font-size: 0.43rem;
  letter-spacing: 0.16em;
}

.hub-game-preview-placeholder strong {
  color: var(--hub-pink);
  font-size: 3rem;
  line-height: 1;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.65);
}

.hub-game-preview.image-missing #hub-game-preview-image {
  display: none;
}

.hub-game-preview-copy {
  padding: 13px 7px 5px;
}

.hub-game-preview-label,
.hub-game-preview-meta,
.hub-game-preview-source,
.hub-game-preview-copy h3 {
  margin: 0;
}

.hub-game-preview-label {
  color: var(--hub-cyan);
  font-size: 0.38rem;
  letter-spacing: 0.18em;
}

.hub-game-preview-copy h3 {
  margin-top: 8px;
  color: #fff;
  font-size: clamp(0.72rem, 1.25vw, 1.05rem);
  line-height: 1.45;
  letter-spacing: 0.035em;
  text-shadow: 2px 2px 0 #000;
}

.hub-game-preview-meta {
  margin-top: 9px;
  color: var(--hub-gold);
  font-size: 0.42rem;
  letter-spacing: 0.1em;
}

.hub-game-preview-source {
  margin-top: 9px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.34rem;
  letter-spacing: 0.1em;
}

.hub-library-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 15px;
}

.hub-library-heading p,
.hub-library-heading h2 {
  margin: 0;
}

.hub-library-heading h2 {
  margin-top: 7px;
  color: #fff;
  font-size: clamp(0.9rem, 1.7vw, 1.25rem);
  letter-spacing: 0.12em;
}

.hub-game-count {
  color: var(--hub-gold);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
}

.hub-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.hub-search-icon {
  position: absolute;
  left: 14px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--hub-cyan);
  border-radius: 50%;
  pointer-events: none;
}

.hub-search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 2px;
  right: -5px;
  bottom: -3px;
  background: var(--hub-cyan);
  transform: rotate(45deg);
  transform-origin: left center;
}

#hub-game-search {
  width: 100%;
  min-height: 45px;
  padding: 12px 13px 11px 42px;
  border: 1px solid rgba(100, 248, 255, 0.27);
  border-radius: 0;
  outline: none;
  background: rgba(0, 4, 13, 0.7);
  color: #fff;
  caret-color: var(--hub-pink);
  font: inherit;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  -webkit-user-select: text;
  user-select: text;
}

#hub-game-search::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

#hub-game-search:focus {
  border-color: var(--hub-cyan);
  box-shadow: inset 0 0 18px rgba(100, 248, 255, 0.08), 0 0 12px rgba(100, 248, 255, 0.1);
}

.hub-game-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--hub-pink) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hub-game-list::-webkit-scrollbar {
  width: 8px;
}

.hub-game-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.hub-game-list::-webkit-scrollbar-thumb {
  background: var(--hub-pink);
}

.hub-game-item {
  position: relative;
  width: 100%;
  min-height: 50px;
  padding: 12px 34px 12px 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  background: transparent;
  font-size: 0.58rem;
  line-height: 1.5;
  letter-spacing: 0.035em;
}

.hub-game-item::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: rgba(100, 248, 255, 0.4);
  box-shadow: 0 0 6px rgba(100, 248, 255, 0.3);
}

.hub-game-item::after {
  content: ">";
  position: absolute;
  right: 13px;
  color: var(--hub-gold);
  opacity: 0;
  transform: translateX(-5px);
}

.hub-game-item:hover,
.hub-game-item:focus-visible {
  color: #fff;
  outline: none;
  background: linear-gradient(90deg, rgba(255, 77, 166, 0.2), rgba(100, 248, 255, 0.07));
  box-shadow: inset 3px 0 0 var(--hub-pink);
}

.hub-game-item:hover::before,
.hub-game-item:focus-visible::before {
  background: var(--hub-gold);
  box-shadow: 0 0 9px var(--hub-gold);
}

.hub-game-item:hover::after,
.hub-game-item:focus-visible::after {
  opacity: 1;
  transform: translateX(0);
}

.hub-empty-state {
  margin: auto;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}

.hub-demo-status {
  position: absolute;
  left: 50%;
  bottom: -26px;
  transform: translateX(-50%);
  color: #ff8a8a;
  font-size: 0.43rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.hub-library-footer {
  padding-top: 15px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.39rem;
  line-height: 1.5;
  letter-spacing: 0.08em;
}

.hub-corner {
  position: absolute;
  z-index: 7;
  width: 50px;
  height: 50px;
  pointer-events: none;
}

.hub-corner-tl {
  top: 15px;
  left: 15px;
  border-top: 2px solid rgba(100, 248, 255, 0.35);
  border-left: 2px solid rgba(100, 248, 255, 0.35);
}

.hub-corner-br {
  right: 15px;
  bottom: 15px;
  border-right: 2px solid rgba(255, 77, 166, 0.35);
  border-bottom: 2px solid rgba(255, 77, 166, 0.35);
}

@keyframes hub-live-pulse {
  50% { opacity: 0.35; }
}

@keyframes hub-title-in {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes hub-panel-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 760px), (max-aspect-ratio: 2 / 3) {
  .hub-demo-stage {
    bottom: auto;
    height: 52vh;
    height: 52dvh;
  }

  #hub-demo {
    width: min(100vw, 55.467vh);
    width: min(100vw, 55.467dvh);
  }

  .hub-color-wash {
    background:
      linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(1, 5, 16, 0.24) 32%, #02050e 57%, #02050e 100%),
      linear-gradient(90deg, rgba(1, 5, 16, 0.28), transparent 50%, rgba(1, 5, 16, 0.28));
  }

  .hub-topbar {
    height: 60px;
    padding: 10px 12px;
  }

  .hub-status-mark {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
  }

  .hub-layout {
    padding: 64px 12px 12px;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 50vh) minmax(0, 1fr);
    grid-template-rows: minmax(260px, 50dvh) minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
  }

  .hub-title-block {
    align-self: end;
    padding: 0 7px 5px;
  }

  .hub-title-block h1 {
    margin: 6px 0 4px;
    font-size: clamp(1.55rem, 9vw, 2.7rem);
  }

  .hub-eyebrow {
    font-size: 0.4rem;
  }

  .hub-wordmark-row {
    width: 72%;
  }

  .hub-wordmark-row strong {
    font-size: 0.85rem;
  }

  .hub-subtitle {
    display: none;
  }

  .hub-library {
    height: auto;
    min-height: 0;
    padding: 15px;
  }

  .hub-game-preview {
    display: none;
  }

  .hub-library-heading {
    padding-bottom: 10px;
  }

  .hub-library-heading h2 {
    font-size: 0.82rem;
  }

  .hub-section-kicker {
    font-size: 0.38rem;
  }

  .hub-search-wrap {
    margin-bottom: 9px;
  }

  #hub-game-search {
    min-height: 41px;
  }

  .hub-game-item {
    min-height: 47px;
    font-size: 0.52rem;
  }

  .hub-library-footer {
    padding-top: 9px;
  }

  .hub-library-footer span:last-child {
    display: none;
  }
}

@media (max-width: 430px) {
  .hub-button-label {
    display: none;
  }

  .hub-back-button {
    width: 42px;
    justify-content: center;
    padding: 0;
  }

  .hub-language-button {
    width: 50px;
    gap: 4px;
  }

  .hub-language-flag {
    width: 20px;
    height: 13px;
    flex-basis: 20px;
  }

  .hub-corner {
    display: none;
  }
}

/* Unfolded Fold: Brave can report the inner screen as either portrait or
   landscape after its browser chrome is subtracted. Use the square-ish shape
   only, reserve a real top section, and keep the library below the full frame. */
@media (min-aspect-ratio: 3 / 4) and (max-aspect-ratio: 4 / 3) {
  .hub-demo-stage {
    inset: 60px 0 auto;
    height: clamp(260px, 44vh, 460px);
    height: clamp(260px, 44dvh, 460px);
  }

  #hub-demo {
    width: min(100vw, clamp(277.333px, 46.934vh, 490.667px));
    width: min(100vw, clamp(277.333px, 46.934dvh, 490.667px));
  }

  .hub-layout {
    height: 100%;
    padding: 64px 12px 12px;
    grid-template-columns: 1fr;
    grid-template-rows: clamp(260px, 44dvh, 460px) minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
  }

  .hub-title-block {
    align-self: end;
    padding: 0 7px 7px;
  }

  .hub-title-block h1 {
    font-size: clamp(1.55rem, 7vw, 3.2rem);
  }

  .hub-subtitle,
  .hub-game-preview {
    display: none;
  }

  .hub-library {
    height: auto;
    min-height: 0;
    padding: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-status-dot,
  .hub-title-block,
  .hub-library {
    animation: none;
  }

  .hub-game-preview {
    transition: none;
  }
}
