@font-face { font-family: Gilroy; src: url("fonts/Gilroy-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Gilroy; src: url("fonts/Gilroy-Medium.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: Gilroy; src: url("fonts/Gilroy-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: Gilroy; src: url("fonts/Gilroy-Extrabold.ttf") format("truetype"); font-weight: 800; font-style: normal; font-display: swap; }

:root {
  --bg: #1e0041;
  --field: #4a148c;
  --purple: #902ff2;
  --pink: #ff0090;
  --cyan: #4ebafc;
  --gold: #fccc2a;
  --cream: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--cream);
  font-family: Gilroy, Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.lobby {
  --icon-size: min(176px, 42vw, 24dvh);
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, #902ff2 0%, #ff0090 100%);
}

.top {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: clamp(26px, 5vw, 40px);
  padding:
    max(14px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    16px
    max(20px, env(safe-area-inset-left));
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(
    150deg,
    rgba(255, 140, 220, 0.42) 0%,
    rgba(180, 70, 230, 0.22) 46%,
    rgba(90, 30, 170, 0.32) 100%
  );
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

.brand-link {
  display: block;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.brand-logo {
  display: block;
  height: 1.35em;
  width: auto;
  max-width: min(210px, 46vw);
  pointer-events: none;
  -webkit-user-drag: none;
}

.content {
  flex: 1;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  min-height: 0;
  overflow: hidden;
  padding:
    clamp(8px, 2vh, 24px)
    max(12px, env(safe-area-inset-right))
    max(clamp(8px, 2vh, 24px), env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.center-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.8vh, 20px);
  min-height: 0;
  width: 100%;
}

.tagline {
  flex-shrink: 0;
  font-weight: 800;
  font-size: clamp(26px, 6.2vw, 48px);
  line-height: 1.15;
  text-align: center;
  padding: 0 12px;
}

.games {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, auto);
  grid-auto-flow: row;
  justify-content: center;
  justify-items: center;
  align-content: center;
  align-items: start;
  gap: clamp(8px, 1.6vh, 24px) clamp(12px, 4vw, 28px);
}

.game {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  width: var(--icon-size);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 0.8vh, 10px);
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.icon {
  width: var(--icon-size);
  height: var(--icon-size);
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}

.icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 4px 6px rgba(20, 0, 40, 0.32));
}

.game:active .icon {
  transform: translateY(3px);
}

.game:active .icon img {
  filter: drop-shadow(0 2px 3px rgba(20, 0, 40, 0.24));
}

.game span {
  font-weight: 500;
  font-size: clamp(12px, 1.8vh, 16px);
  text-align: center;
  line-height: 1.15;
}

.more-games {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(100%, 280px);
  padding: 16px 36px;
  border-radius: 999px;
  background: #902FF2;
  color: #fff;
  font-size: clamp(16px, 2.4vh, 22px);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.more-games:active {
  background: #7a1fd4;
}

@media (max-width: 900px) and (orientation: portrait) {
  .lobby {
    --icon-size: min(168px, 38vw, 21dvh);
  }

  .top {
    font-size: clamp(22px, 4.4vw, 32px);
    padding-bottom: 10px;
  }
}

@media (max-width: 900px) and (max-height: 720px) and (orientation: portrait) {
  .lobby {
    --icon-size: min(148px, 36vw, 19.5dvh);
  }
}

@media (orientation: landscape) {
  .lobby {
    --icon-size: min(176px, 26vw, calc((100dvh - 14rem) / 2));
  }

  .top {
    font-size: clamp(18px, 3.6vw, 28px);
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 8px;
  }

  .tagline {
    font-size: clamp(24px, 7.5vh, 44px);
  }

  .games {
    display: grid;
    grid-template-columns: repeat(3, auto);
    grid-template-rows: repeat(2, auto);
    justify-content: center;
    justify-items: center;
    align-content: center;
    align-items: start;
    gap: clamp(8px, 2.4vh, 20px) clamp(20px, 4vw, 48px);
    width: 100%;
    min-height: 0;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .lobby {
    --icon-size: min(112px, 20vw, calc((100dvh - 11.5rem) / 2));
  }

  .top {
    font-size: clamp(16px, 3.4vw, 22px);
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: 6px;
  }

  .content {
    gap: 6px;
    padding-top: 6px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .tagline {
    font-size: clamp(22px, 8vh, 36px);
  }

  .games {
    gap: 6px clamp(14px, 3vw, 28px);
  }
}
